[]previous and next page

DuskHandler

What createHandler returns: the Handler plus the validated environment and the SPA shell used by @shadow-js/dusk/static.

What createHandler returns: the Handler plus the validated environment and the SPA shell used by @shadow-js/dusk/static.

Import#

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

Signature#

ts
interface DuskHandler extends Handler {
  /** The validated environment, or `undefined` when none is configured or it is validated on the first request. */
  readonly env: ParsedEnv | undefined;
  /**
   * The host patterns the handler accepts (`security.allowedHosts`), or `undefined` when it accepts
   * any host. Prerendering reads it to send its requests to a host the handler allows.
   */
  readonly allowedHosts: readonly string[] | undefined;
  /**
   * Renders the document without any route content: the shell a single-page app boots from.
   * Status 200, no loaders run.
   */
  renderShell(request?: Request): Promise<Response>;
}

Members#

Name Type Description
env readonly env: ParsedEnv | undefined The validated environment, or undefined when none is configured or it is validated on the first request.
allowedHosts readonly allowedHosts: readonly string[] | undefined The host patterns the handler accepts (security.allowedHosts), or undefined when it accepts any host. Prerendering reads it to send its requests to a host the handler allows.
renderShell renderShell(request?: Request): Promise<Response> Renders the document without any route content: the shell a single-page app boots from. Status 200, no loaders run.