Skip to main content

RouteRequestHandler

Overview

Usage

import { RouteRequestHandler } from 'keywork/router/interfaces'

Type parameters

NameTypeDescription
BoundAliases{}The bound aliases, usually defined in your wrangler.toml file.
ExpectedParams{}Optional string union of route path parameters. Only supported in Cloudflare Pages.
DataRecord<string, unknown>Optional extra data to be passed to a route handler, usually from middleware.
ExpectedReturnextends ResponseLike = ResponseLike-

Callable

RouteRequestHandler

RouteRequestHandler

(event, next): `ExpectedReturn` | `Promise<`ExpectedReturn`>`

A function or method that handles incoming requests and replies with a Response.

Generally, this is interface is assigned to a RequestRouter method, such as onRequestGet The IsomorphicFetchEvent argument is provided by the router's fetch method.

Parameters

NameType
eventIsomorphicFetchEvent<BoundAliases, ExpectedParams, Data>
nextMiddlewareFetch<BoundAliases, MiddlewareReturnTypes>

Returns

ExpectedReturn | Promise<ExpectedReturn>

Defined in

router/interfaces/RouteRequestHandler.ts:38