Skip to content

Instantly share code, notes, and snippets.

@MikeFielden
Created August 28, 2015 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MikeFielden/12c5cc5e2370942f5d45 to your computer and use it in GitHub Desktop.
Save MikeFielden/12c5cc5e2370942f5d45 to your computer and use it in GitHub Desktop.
Parallel middlewares
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