Skip to main content
Module

x/cav/endpoint.ts

A server framework for Deno
Go to Latest
import * as cav from "https://deno.land/x/cav@0.2.0-alpha.4/endpoint.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.

Creates an endpoint for serving a TypeScript or JavaScript bundle. The bundle is cached into memory and will be watched and rebundled whenever updated, if possible.

Constructs a new Endpoint request handler using the provided schema and resolver function. The schema properties will be assigned to the returned endpoint function, so that they can be reused on other endpoint schemas.

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 "./" or 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

Arguments available to Context functions.

Options for processing requests, used to construct Endpoints.

Arguments available to a ResolveError function.

Arguments available to the resolver of an endpoint.

Arguments available to the setup function of a socket endpoint.

Schema options for creating a socket() handler.

Type Aliases

Initializer options for creating an assets() endpoint.

Initializer options for creating a bundle() endpoint.

Cav Endpoint handler, for responding to requests.

Cav endpoint handler for connecting web sockets.