Skip to main content
Module

x/composium/mod.ts

Powered by functional composition and the URL Pattern API, composium has become the most flexible routing framework in the world.
Go to Latest
import * as composium from "https://deno.land/x/composium@v0.1.1/mod.ts";

Classes

An instance of the extendable Context is passed as only argument to your Middlewares. You can optionally extend the default Context object or pass a State type.

Variables

Composes single-argument functions from right to left. The rightmost function can take multiple arguments as it provides the signature for the resulting composite function. It accepts sync and async functions.

Composes single-argument functions from right to left. The rightmost function can take multiple arguments as it provides the signature for the resulting composite function. The function composeSync doesn't accept async functions but composes non-async functions faster than compose does.

Functions

Takes a Middleware and returns a Deno.ServeHandler.

A curried function which takes a Context class, tryMiddlewares, catchMiddlewares and finallyMiddlewares and returns a Deno.ServeHandler which can be passed to Deno.serve. It also handles the HTTP method HEAD appropriately, sets the X-Response-Time header and logs to the console by default. Optionally you can enable the logger or pass an initial state object.

A curried function which takes HTTP Methods, a URLPatternInput and Middlewares and returns in the end a composed route function.