[]previous and next page

FetchModule

The module shape a platform expects: a Web fetch.

The module shape a platform expects: a Web fetch.

Import#

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

Signature#

ts
interface FetchModule {
  fetch(request: Request, env?: unknown, ctx?: WaitUntilContext): Promise<Response>;
  /**
   * Present when the handler runs its middleware for files (`runMiddlewareForStaticFiles`): decides a file request the
   * same way the handler's `gateAsset` does, with the platform the `fetch` of this module would pass.
   */
  gateAsset?(request: Request, env?: unknown, ctx?: WaitUntilContext): Promise<AssetDecision>;
}

Members#

Name Type Description
fetch fetch(request: Request, env?: unknown, ctx?: WaitUntilContext): Promise<Response>
gateAsset? gateAsset?(request: Request, env?: unknown, ctx?: WaitUntilContext): Promise<AssetDecision> Present when the handler runs its middleware for files (runMiddlewareForStaticFiles): decides a file request the same way the handler's gateAsset does, with the platform the fetch of this module would pass.