npm install http-middlewareMiddleware layer for http.
sh
$ npm install http-middleware
`Usage
`js
const mw = require('http-middleware')
const http = require('http')http.createServer((req, res) => {
const fns = [
(req, res) => res.write('oh yeah!'),
(req, res, next) => {
res.statusCode = 200
next()
}
]
mw(req, res, fns, res.end)
}).listen(1337)
`API
$3
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.[npm-image]: https://img.shields.io/npm/v/http-middleware.svg?style=flat-square
[npm-url]: https://npmjs.org/package/http-middleware
[travis-image]: https://img.shields.io/travis/yoshuawuyts/http-middleware/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/yoshuawuyts/http-middleware
[codecov-image]: https://img.shields.io/codecov/c/github/yoshuawuyts/http-middleware/master.svg?style=flat-square
[codecov-url]: https://codecov.io/github/yoshuawuyts/http-middleware
[downloads-image]: http://img.shields.io/npm/dm/http-middleware.svg?style=flat-square
[downloads-url]: https://npmjs.org/package/http-middleware
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: https://github.com/feross/standard