其他分享
首页 > 其他分享> > Express.js -- Request Object

Express.js -- Request Object

作者:互联网

req.params

Return route param. The stuff before query param -- '?'

router.get('/yomama/:something', function(req, res, next) {
  console.log(req.params.something);
});

http://localhost:3000/fibonacci/yomama/3wafwa?node=xxx

3wafwa

req.query

Return query string object. The stuff after query param -- '?'

router.get('/yomama/:something', function(req, res, next) {
  console.log(req.query)
});

http://localhost:3000/fibonacci/yomama/3wafwa?node=xxx

{ node: 'xxx' }

req.path

return everything until '?'

req.url

return the entire req url

req.body

return the entire req body

标签:node,3wafwa,Object,req,yomama,--,Express,fibonacci,query
来源: https://blog.csdn.net/DOITJT/article/details/122769140