Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/composium/mod.ts

Create handlers for Deno.serve. Powered by functional composition and the URL Pattern API.
Latest
import * as composium from "https://deno.land/x/composium@v0.1.2/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 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.