Express.js -- Request Object
作者:互联网
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
标签:node,3wafwa,Object,req,yomama,--,Express,fibonacci,query 来源: https://blog.csdn.net/DOITJT/article/details/122769140