RouteRequestHandler
Overview
Usage
- Node
- Deno
import { RouteRequestHandler } from 'keywork/router/interfaces'
import { RouteRequestHandler } from 'https://deno.land/x/keywork/router/interfaces'
Type parameters
Name | Type | Description |
---|---|---|
BoundAliases | {} | The bound aliases, usually defined in your wrangler.toml file. |
ExpectedParams | {} | Optional string union of route path parameters. Only supported in Cloudflare Pages. |
Data | Record<string, unknown> | Optional extra data to be passed to a route handler, usually from middleware. |
ExpectedReturn | extends ResponseLike = ResponseLike | - |
Callable
RouteRequestHandler
RouteRequestHandler
(event, next): `ExpectedReturn` | `Promise<`ExpectedReturn`>`
Parameters
Name | Type |
---|---|
event | IsomorphicFetchEvent< BoundAliases, ExpectedParams, Data> |
next | MiddlewareFetch< BoundAliases, MiddlewareReturnTypes> |
Returns
ExpectedReturn
| Promise<
ExpectedReturn>
Defined in
router/interfaces/RouteRequestHandler.ts:38
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
TheIsomorphicFetchEvent
argument is provided by the router'sfetch
method.