diff --git a/frameworks/TypeScript/deno/deno.dockerfile b/frameworks/TypeScript/deno/deno.dockerfile index bd98d179541..cfb43644c10 100644 --- a/frameworks/TypeScript/deno/deno.dockerfile +++ b/frameworks/TypeScript/deno/deno.dockerfile @@ -1,4 +1,4 @@ -FROM denoland/deno:1.42.1 +FROM denoland/deno:1.46.1 EXPOSE 8080 @@ -12,4 +12,4 @@ RUN deno cache main.ts EXPOSE 8080 -CMD ["run", "-A", "--unstable-net", "spawn.ts"] +CMD ["deno", "serve", "--parallel", "--port", "8080", "--host", "0.0.0.0", "-A", "main.ts"] diff --git a/frameworks/TypeScript/deno/src/main.ts b/frameworks/TypeScript/deno/src/main.ts index 347e7f4c1a8..3e6f71506bd 100644 --- a/frameworks/TypeScript/deno/src/main.ts +++ b/frameworks/TypeScript/deno/src/main.ts @@ -1,9 +1,8 @@ const HELLO_WORLD_STR = "Hello, World!"; const options: ResponseInit = { headers: { "Server": "Deno" } }; -Deno.serve({ - reusePort: true, - handler: (req: Request) => { +export default { + fetch: (req: Request) => { const path = req.url.slice(req.url.indexOf("/", 8)); if (path == "/plaintext") { return new Response(HELLO_WORLD_STR, options); @@ -13,10 +12,4 @@ Deno.serve({ return new Response("404 Not Found", { status: 404, ...options }); } }, - onError(err) { - console.error(err); - Deno.exit(9); - }, - port: 8080, - hostname: "0.0.0.0", -}); +}; diff --git a/frameworks/TypeScript/deno/src/spawn.ts b/frameworks/TypeScript/deno/src/spawn.ts deleted file mode 100644 index cc56c4543b6..00000000000 --- a/frameworks/TypeScript/deno/src/spawn.ts +++ /dev/null @@ -1,13 +0,0 @@ -import os from "node:os"; -import process from "node:process"; - -const numCPUs = os.cpus().length; -for (let i = 0; i < numCPUs; i++) { - new Deno.Command(Deno.execPath(), { - args: ["run", "-A", "--unstable-net", "main.ts"], - stdin: "inherit", - stdout: "inherit", - stderr: "inherit", - env: { ...process.env }, - }).spawn(); -}