fix: allow setting server config from fresh config (#1889)

This commit is contained in:
Marvin Hagemeister
2023-10-09 13:59:30 +02:00
committed by GitHub
parent 4fac2a22a6
commit 32eb61c95d
11 changed files with 266 additions and 6 deletions
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env -S deno run -A --watch=static/,routes/
import dev from "$fresh/dev.ts";
const TEST_CONFIG_SERVER = Deno.env.get("TEST_CONFIG_SERVER") === "true";
const onListen = (params: { hostname: string; port: number }) => {
console.log("it works");
console.log(`http://localhost:${params.port}`);
};
const onListen2 = (params: { hostname: string; port: number }) => {
console.log("it works #2");
console.log(`http://localhost:${params.port}`);
};
await dev(import.meta.url, "./main.ts", {
server: {
onListen: TEST_CONFIG_SERVER ? onListen2 : undefined,
},
onListen: TEST_CONFIG_SERVER ? undefined : onListen,
});