parallel-middleware
v1.0.1
Published
Run middleware in parallel
Downloads
6
Readme
Run middleware in parallel
Run express style middleware in parallel, thats all.
Install
$ npm install --save parallel-middleware
Usage
var parallel = require('parallel-middleware')
var app = require('express')()
app.use(parallel([
middleware1,
middleware2,
middleware3
]), function (req, res) {
// Middleware ran without error
res.status(204)
}, funciton (err, req, res, next) {
// An error occured in one of the middleware
res.status(500)
})
// Run parallel with a timeout of 5 seconds
app.use(parallel([
middleware1,
middleware2,
middleware3
], {
timeout: 5000
}))
Credit where credit is due, this was originally a fork of Hunter Loftis' package. I have changed a bunch, including the package name.