import { serve } from "https://deno.land/x/netzo@v0.1.52/mod.ts";
serve() registers "fetch" event listener and invokes the provided route handler for the route with the request as first argument and processed path params as the second.
Examples
Example 1
Example 1
serve({
"/": (request: Request) => new Response("Hello World!"),
404: (request: Request) => new Response("not found")
})
The route handler declared for 404
will be used to serve all
requests that do not have a route handler declared.