shawn-mcginty / naboris

Simple, fast, minimalist http server for OCaml/ReasonML
https://naboris.dev
MIT License
71 stars 4 forks source link

Add middleware hooks and unify API #21

Closed shawn-mcginty closed 4 years ago

shawn-mcginty commented 4 years ago

add hooks for middleware

maybe beforeRouteRequest?

beforeRouteRequest could be a fn that takes something like Route.t -> Req.t -> Res.t -> (Route.t -> Req.t -> Res.t -> (Route.t * Req.t * Res.t) Lwt.t) -> (Route.t * Req.t * Res.t) Lwt.t) meaning it's last arg is the routeRequest function, which should be called to continue the lifecycle of the request.

maybe afterRouteRequest? I'm not as sure about that one

shawn-mcginty commented 4 years ago

This is in 0.0.7