Skip to main content
Module

x/cav/endpoints.ts

A server framework for Deno
Go to Latest
import * as cav from "https://deno.land/x/cav@0.0.24/endpoints.ts";

Functions

Creates an Endpoint for serving static assets. The routed request path will be used to find the asset to serve from inside the assets directory specified.

Constructs a new Endpoint request handler using the provided schema and resolver function. The schema properties will be assigned to the returned endpoint function, with the resolve argument available as the "resolve" property.

Creates an Endpoint that always redirects. The "path" schema option is "/", i.e. the whole request path should have been consumed by the containing router(s) before the request reaches a redirect endpoint. If the redirect path doesn't specify an origin, the origin of the request is used. If the path starts with a ".", it's joined with the pathname of the Request url to get the final redirect path. The default status is 302.

Constructs a new Socket request handler using the provided schema and setup function. The schema properties will be assigned to the returned socket endpoint function, with the setup argument available as the "setup" property.

Interfaces

Initializer options for creating an assets() endpoint.

Arguments available to Context functions.

Options for processing requests, used to construct Endpoints.

Arguments available to the resolve function of an endpoint.

Arguments available to a ResolveError function.

Arguments available to the setup function of a socket endpoint.

Schema options for creating a socket() handler.

Type Aliases

Type utility for extracting the output of a "ctx" function on an EndpointSchema or SocketSchema.

Cav Endpoint handler, for responding to requests.

Type utility for extracting the output of a "groups" parser on an EndpointSchema or SocketSchema.

Type utility for extracting the output of a "message" parser on an EndpointSchema or SocketSchema.

Type utility for extracting the output of a "query" parser on an EndpointSchema or SocketSchema.

Type utility for extracting the type of message a socket expects to send from a SocketSchema.

Cav endpoint handler for connecting web sockets.