diff options
author | 2022-10-12 21:27:56 +0000 | |
---|---|---|
committer | 2022-10-12 21:27:56 +0000 | |
commit | 575bf9205e7b5875c6b95d49339ff448f59eaad4 (patch) | |
tree | 5e14d483fea818032722fbe8a8ac06944a41a337 /packages/integrations/node/src/standalone.ts | |
parent | e55af8a23233b6335f45b7a04b9d026990fb616c (diff) | |
download | astro-575bf9205e7b5875c6b95d49339ff448f59eaad4.tar.gz astro-575bf9205e7b5875c6b95d49339ff448f59eaad4.tar.zst astro-575bf9205e7b5875c6b95d49339ff448f59eaad4.zip |
[ci] format
Diffstat (limited to 'packages/integrations/node/src/standalone.ts')
-rw-r--r-- | packages/integrations/node/src/standalone.ts | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/packages/integrations/node/src/standalone.ts b/packages/integrations/node/src/standalone.ts index 8fef96ed5..e0435a2ea 100644 --- a/packages/integrations/node/src/standalone.ts +++ b/packages/integrations/node/src/standalone.ts @@ -1,15 +1,15 @@ import type { NodeApp } from 'astro/app/node'; -import type { Options } from './types'; import path from 'path'; import { fileURLToPath } from 'url'; -import middleware from './middleware.js'; import { createServer } from './http-server.js'; +import middleware from './middleware.js'; +import type { Options } from './types'; function resolvePaths(options: Options) { const clientURLRaw = new URL(options.client); const serverURLRaw = new URL(options.server); const rel = path.relative(fileURLToPath(serverURLRaw), fileURLToPath(clientURLRaw)); - + const serverEntryURL = new URL(import.meta.url); const clientURL = new URL(appendForwardSlash(rel), serverEntryURL); @@ -35,16 +35,19 @@ export function getResolvedHostForHttpServer(host: string | boolean) { } export default function startServer(app: NodeApp, options: Options) { - const port = process.env.PORT ? Number(process.env.port) : (options.port ?? 8080); + const port = process.env.PORT ? Number(process.env.port) : options.port ?? 8080; const { client } = resolvePaths(options); const handler = middleware(app); const host = getResolvedHostForHttpServer(options.host); - const server = createServer({ - client, - port, - host, - }, handler); + const server = createServer( + { + client, + port, + host, + }, + handler + ); // eslint-disable-next-line no-console console.log(`Server listening on http://${host}:${port}`); |