[]previous and next page

workerFetch

Wraps a handler as the Worker module.

Wraps a handler as the Worker module. Use it when you write your own entry instead of the emitted one: export default workerFetch(handler).

Import#

ts
import { workerFetch } from "@shadow-js/dusk/cloudflare";

Signature#

ts
function workerFetch(handler: Handler): FetchModule

Parameters#

Name Description
handler The handler from the server bundle.

Returns#

A { fetch(request, env, ctx) } module.

Examples#

ts
import { workerFetch } from "@shadow-js/dusk/cloudflare";
import { handler } from "./dist/server/entry.js";
export default workerFetch(handler);