Created
March 1, 2015 23:46
-
-
Save boutell/0f29e90a7199e40a1df0 to your computer and use it in GitHub Desktop.
middleware to unify req.body, req.query, req.params as req.params
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
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