chore: remove ServerContext from start server (#1942)

This commit is contained in:
Marvin Hagemeister
2023-10-15 08:53:53 +02:00
committed by GitHub
parent 57054d29b3
commit c3938dc703
3 changed files with 6 additions and 9 deletions
+2 -5
View File
@@ -1,9 +1,8 @@
import { ServerContext } from "./context.ts";
import { colors } from "./deps.ts";
import { ServeHandler } from "./types.ts";
export async function startFromContext(
ctx: ServerContext,
export async function startServer(
handler: Deno.ServeHandler,
opts: Partial<Deno.ServeTlsOptions>,
) {
if (!opts.onListen) {
@@ -24,8 +23,6 @@ export async function startFromContext(
opts.port ??= parseInt(portEnv, 10);
}
const handler = ctx.handler();
if (opts.port) {
await bootServer(handler, opts);
} else {
+2 -2
View File
@@ -13,7 +13,7 @@ import {
ServeHandlerInfo,
UnknownHandler,
} from "./types.ts";
import { startFromContext } from "./boot.ts";
import { startServer } from "./boot.ts";
export {
defineApp,
defineConfig,
@@ -101,5 +101,5 @@ export async function start(manifest: Manifest, config: FreshConfig = {}) {
skipSnapshot: false,
dev: false,
});
await startFromContext(ctx, config.server ?? config);
await startServer(ctx.handler(), config.server ?? config);
}