feat: update Deno.serve function signature (#15563)

This commit changes the `Deno.serve` function signature to be more
versatile and easier to use. It is now a drop in replacement for
std/http's `serve`.

The input validation has also been reworked.
This commit is contained in:
Luca Casonato 2022-08-24 00:08:56 +02:00 committed by GitHub
parent f0993f413b
commit 4ef08a58df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 253 additions and 148 deletions

View file

@ -7,4 +7,4 @@ const [hostname, port] = addr.split(":");
const app = new Hono();
app.get("/", (c) => c.text("Hello, World!"));
Deno.serve({ fetch: app.fetch, port: Number(port), hostname });
Deno.serve(app.fetch, { port: Number(port), hostname });