小编chr*_*ine的帖子

Express:req.params vs req.body(JSON)

哪个更正确,为什么?它取决于场景吗?有标准吗?

router.post("/user", function(req, res) {
  let thisUserId = req.body.userId;
});

router.post("/user/:userId", function(req, res) {
  let thisUserId = req.params.userId;
}
Run Code Online (Sandbox Code Playgroud)

谢谢!

rest node.js express

3
推荐指数
2
解决办法
784
查看次数

标签 统计

express ×1

node.js ×1

rest ×1