Skip to main content
Module

x/composium/handler.ts>createHandler

Powered by functional composition and the URL Pattern API, composium has become the most flexible routing framework in the world.
Go to Latest
function createHandler
import { createHandler } from "https://deno.land/x/composium@v0.1.0/handler.ts";

A curried function which takes catchMiddlewares, finallyMiddlewares, a Context class and tryMiddlewares and returns in the end a Handler function which can be passed to listen. 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.

createHandler(catchMiddlewares)(finallyMiddlewares)(Ctx)(tryMiddlewares)

Parameters

...catchMiddlewares: Middleware<C>[]