Skip to main content
Module

x/reno/reno/router.ts

A thin, testable routing library designed to sit on top of Deno's standard HTTP module
Latest
import * as reno from "https://deno.land/x/reno@v2.0.105/reno/router.ts";

Classes

An error that's thrown by Reno when a route for a particular request's path cannot be found in the router's route map. You won't need to instantiate and throw this directly, but it's exported to support instanceof checks in error handling logic:

Functions

Creates a RouteMap, a Map that holds route handling functions and keys them by the path by which the router will make them accessible:

Creates a Reno router for the given routes, which can then be invoked as an async function when Deno's HTTP server receives a request:

Type Aliases

The standard request type used througout Reno, which is passed to user-defined route handler functions. Mostly identical to std/http's ServerRequest, except the inclusion of Reno-specific props for ease of use.

The standard response type returned by route handler functions. Essentially the same as std/http's Response, but also exposes cookies as an array of [string, string] tuples.

A user-defined route handler for a particular route.

A standard ECMAScript Map that holds route handler functions that are keyed by either RegExps or strings.

The router function returned by createRouter that is intended to be invoked when a HTTP server receives a request.

A function that takes a routes map and returns an invocable router function.