Middleware layer for
$ npm install http-middleware
const mw =const http =http
mw(req, res, middleware [,done])
Create a middleware layer that runs an array of middleware functions in
sequence. Middleware functions have a signature of
req, res, next where
next is optional.
What is middleware?
Middleware is typically an array of functions that is run before executing 'business logic'. Function types include authentication, rate limiting, logging and more.
Why not use a framework for middleware?
Frameworks are a bundle of opinions. By splitting features off into separate modules (like this middleware module) users can compose their perfect framework. See http-framework for more modules in this spirit.