Skip to main content
Deno.ServeDefaultExport - Deno documentation
interface Deno.ServeDefaultExport

Interface that module run with deno serve subcommand must conform to.

To ensure your code is type-checked properly, make sure to add satisfies Deno.ServeDefaultExport to the export default { ... } like so:

export default {
  fetch(req) {
    return new Response("Hello world");
  }
} satisfies Deno.ServeDefaultExport;

Properties

fetch: (request: Request) => Response | Promise<Response>

A handler for HTTP requests. Consumes a request and returns a response.

If a handler throws, the server calling the handler will assume the impact of the error is isolated to the individual request. It will catch the error and if necessary will close the underlying connection.