Created
August 28, 2015 12:51
-
-
Save MikeFielden/12c5cc5e2370942f5d45 to your computer and use it in GitHub Desktop.
Parallel middlewares
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parallel(middlewares) { | |
return function (req, res, next) { | |
async.each(middlewares, function (mw, cb) { | |
mw(req, res, cb); | |
}, next); | |
}; | |
} | |
app.use(parallel([ | |
getUser, | |
getSiteList, | |
getCurrentSite, | |
getSubscription | |
])); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment