import { type EndpointSchema } from "https://deno.land/x/cav@0.2.3/mod.ts";
Options for processing requests, used to construct Endpoints.
Properties
URLPattern string to match against the Request's routed path. If the string starts with '^', the full request path will be used instead.The full URLPattern syntax is supported.
The default is an empty string, meaning all path segments should've been routed already before this endpoint is called.
Any captured path parameters will be merged into the path parameters captured during routing.
Parses any path parameters captured during routing. The result is available as the "param" resolve argument. This parser will receive ParamRecord inputs.
If an error is thrown during parsing, the endpoint won't match with the request and the router will continue looking for matching handlers.
Factory function endpoints for creating a custom request context, which is
available to resolves as the ctx
argument.
Context handling happens after the endpoint matched with the Request but before input validation begins.
Parses the query string parameters passed into the URL. Parsed query parameters are available to resolvers as the "query" argument. This parser will receive QueryRecord inputs.
Parsing fails when an error is thrown. If the error isn't an HttpError, it'll be wrapped in a 400 HttpError.
Limits the size of posted bodies. If a body exceeds the limit, a 413 HttpError will be thrown and serialized back to the client.
If 0 is specified, body size is unlimited. (Don't do that.) The default is 1024 * 1024 bytes (1 Megabyte).
Parses the POSTed body, if there is one. The behavior of this parser determines the methods allowed for this endpoint. The output from parsing is available to resolvers as the "body" argument. This parser will receive unknown inputs.
If there is no parser, only GET and HEAD requests will be allowed. If there
is one and it successfully parses undefined
, POST will also be allowed.
If the parser throws when parsing undefined
, only POST will be allowed.
If specified, an error thrown during request processing will be processed with this function, which can return a value to send back to the client instead of the serialized error.