Skip to main content
Module

x/composium/mod.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.0.6/mod.ts";

A curried function which takes a Context class, mainHandlers, catchHandlers and finallyHandlers and returns in the end a Handler function which can be passed to the function listen. You can pass an initial state and it handles the request's method HEAD appropriately by default.

createHandler(Ctx)(mainHandler)(catchHandler)(finallyHandler)

Type Parameters

C extends Context
S

Parameters

Context: new (
request: Request,
connInfo: ConnInfo,
state?: S,
) => C
optional
unnamed 1: { state?: S; isHandlingHead?: boolean; } = [UNSUPPORTED]