Get form data for both POST and GET requests in Express

I want to get the value of parameters for BOTH POST and GET requests in Express/Node.js. I know of methods that will explicitly get POST or GET data, but I would like something that works for both. Is this possible in one line of code?

express.all('/page', function(req, res) {
    var thing = req.body.thing; // only works for POST requests, not GET!
});

Thanks

You're looking for req.param(name, [defaultValue]).

From Express API Reference

Lookup is performed in the following order:

req.params
req.body
req.query

POST is req.body

GET is req.query

express.all('/page', function(req, res) {
    var thing = req.param('thing');
});

Alternatively you can use req.body and req.query directly.