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)
Type Parameters
C extends Context
Parameters
...catchMiddlewares: Middleware<C>[]