[]previous and next page

serve (@shadow-js/dusk/deno)

Serves a handler with Deno.serve.

Serves a handler with Deno.serve.

Import#

ts
import { serve } from "@shadow-js/dusk/deno";

Signature#

ts
function serve(
  handler: Handler,
  options: NativeServeOptions = {},
): Promise<NativeServeHandle>

Parameters#

Name Description
handler The fetch handler, usually handler from the server bundle.
options Port, hostname, static folder, compression and shutdown.

Returns#

The running server.

Throws#

  • Error when the code does not run on Deno.

Examples#

ts
import { serve } from "@shadow-js/dusk/deno";
import { handler } from "./dist/server/entry.js";
await serve(handler, { static: "/srv/app/dist/client", hostname: "0.0.0.0" });