diff --git a/examples/deno/app.js b/examples/deno/app.js index aa5b478..398e683 100644 --- a/examples/deno/app.js +++ b/examples/deno/app.js @@ -1,11 +1,5 @@ -import { serve } from "https://deno.land/std@0.86.0/http/server.ts"; - -const server = serve({ hostname: "0.0.0.0", port: 8080 }); -console.log(`HTTP webserver running. Access it at: http://localhost:8080/`); - -for await (const request of server) { - let bodyContent = ` - +const bodyContent = ` + @@ -68,7 +62,10 @@ for await (const request of server) { } - `; +`; - request.respond({ status: 200, body: bodyContent }); -} +console.log(`HTTP webserver running. Access it at: http://localhost:8080/`); + +Deno.serve({ port: 8080 }, (_req) => { + return new Response(bodyContent); +});