@xtandard/kit/server/router
@xtandard/kit/server/router — the optional declarative router: one route
table drives dispatch, auth, authorization, readonly, 405 + Allow, body
validation and the generated OpenAPI 3.1 document.
import { … } from "@xtandard/kit/server/router";Functions
Section titled “Functions”| Name | Summary |
|---|---|
buildOpenApiDocument |
Build the OpenAPI 3.1 document for a route table. |
createRouter |
Build a router from a route table. |
errorResponse |
A JSON error response object with description. |
openApiOperation |
The OpenAPI operation object for one route. |
ref |
{ $ref: "#/components/schemas/<name>" }. |
toOpenApiPath |
/a/:id/b → /a/{id}/b. |
Interfaces
Section titled “Interfaces”| Name | Summary |
|---|---|
Call |
Per-request state handed to route handlers. |
OpenApiOptions |
Options for buildOpenApiDocument. |
Route |
A route: its spec plus the resource it targets and its handler. |
RouteQueryParam |
A query parameter a route documents. |
Router |
What createRouter returns. |
RouterOptions |
Options for createRouter. |
RouteSpec |
The documented shape of one route (consumed by the OpenAPI builder). |
Type aliases
Section titled “Type aliases”| Name | Summary |
|---|---|
RouteMethod |
HTTP methods the router serves (HEAD is answered by GET routes). |
Schema |
Variables
Section titled “Variables”| Name | Summary |
|---|---|
ERROR_SCHEMA |
The { error, code? } body every error response uses. |