Module Server.Middleware

type handler = IO.Input.t Request.t -> resp:(Response.t -> unit) -> unit

Handlers are functions returning a response to a request. The response can be delayed, hence the use of a continuation as the resp parameter.

type t = handler -> handler

A middleware is a handler transformation.

It takes the existing handler h, and returns a new one which, given a query, modify it or log it before passing it to h, or fail. It can also log or modify or drop the response.

val nil : t

Trivial middleware that does nothing.