[]previous and next page

platformHost

Builds the host object passed to handler.fetch.

Builds the host object passed to handler.fetch. The environment bindings are copied as own enumerable properties (the handler reads only strings from them); the platform hooks are non-enumerable.

Import#

ts
import { platformHost } from "@shadow-js/dusk/server";

Signature#

ts
function platformHost(env: unknown, init: PlatformInit = {}): Record<string, unknown>

Parameters#

Name Description
env The bindings or environment object of the platform, or undefined.
init The platform's client address and waitUntil.

Returns#

The host object.

Examples#

ts
handler.fetch(request, platformHost(env, { waitUntil: (p) => ctx.waitUntil(p) }));