req.params
Return route param. The stuff before query param -- '?'
- Node:
router.get('/yomama/:something', function(req, res, next) {
console.log(req.params.something);
});
- URI:
- Output:
3wafwa
req.query
Return query string object. The stuff after query param -- '?'
- Node
router.get('/yomama/:something', function(req, res, next) {
console.log(req.query)
});
- URI:
http://localhost:3000/fibonacci/yomama/3wafwa?node=xxx
- Output:
{ node: 'xxx' }
req.path
return everything until '?'
- URI: http://localhost:3000/fibonacci/yomama/3wafwa?node=xxx
- Output: /yomama/3wafwa
req.url
return the entire req url
- URI: http://localhost:3000/fibonacci/yomama/3wafwa?node=xxx
- Output: /yomama/3wafwa?node=xxx
req.body
return the entire req body