import { type EndpointSchema } from "https://deno.land/x/cav@0.2.0-alpha.4/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. Any captured path parameters will be merged into the path parameters captured during routing. The matched path is available as the "path" resolver argument.
Parses any path parameters captured during routing. The result is available as the "param" resolver argument. If an error is thrown during parsing, the endpoint won't match with the request and the router will continue looking for matching handlers.
Keys to use when signing cookies. The cookies are available as the "cookie" resolver argument.
Factory function endpoints can use to create a custom context, which is
made available to resolvers as the ctx
property on the resolver
arguments. Context handling happens after the endpoint matched with the
Request but before input validation begins.
Parses the query string parameters passed into the URL. If parsing fails,
undefined
will be parsed to check for a default value. If that also
fails, a 400 bad request error will be sent to the client. The output is
available as the "query" resolver argument.
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 max body size is 1024 * 1024 bytes (1 Megabyte).
Serializers to use when serializing and deserializing Request and Response bodies.
Parses the POSTed body, if there is one. The behavior of this parser
determines the methods allowed for this endpoint. 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. The output
from parsing is available as the "body" resolver argument.
Overrides the type returned by the resolver. The value of this property doesn't matter, it's only used for its type.
If specified, an error thrown during request processing will be passed into this function, which can return a value to send back to the client instead of the error. If an error is re-thrown, that error will be serialized to the client instead of the original error.