[]previous and next page

ApiContext

What a validated API handler receives.

What a validated API handler receives.

Import#

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

Signature#

ts
interface ApiContext<Body, Query> {
  readonly event: RequestEvent;
  /** The parsed and validated JSON body (`undefined` when no `body` schema is given). */
  readonly body: Body;
  /** The validated query (`undefined` when no `query` schema is given). */
  readonly query: Query;
}

Members#

Name Type Description
Body Body
Query Query
event readonly event: RequestEvent
body readonly body: Body The parsed and validated JSON body (undefined when no body schema is given).
query readonly query: Query The validated query (undefined when no query schema is given).