Skip to content

Instantly share code, notes, and snippets.

@boutell
Created March 1, 2015 23:46
Show Gist options
  • Save boutell/0f29e90a7199e40a1df0 to your computer and use it in GitHub Desktop.
Save boutell/0f29e90a7199e40a1df0 to your computer and use it in GitHub Desktop.
middleware to unify req.body, req.query, req.params as req.params
app.use(function(req, res, next) {
var params = {};
_.merge(params, req.body || {}, req.query || {}, req.params || {});
req.params = params;
return next();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment