Javascript 无法通过邮递员发送put请求
我要发送的是Javascript 无法通过邮递员发送put请求,javascript,node.js,Javascript,Node.js,我要发送的是 http://localhost:3000/accounts?user_id=62139fbf-ce6a-4827-8fe8-f1c3197bff82 // params user_id 62139fbf-ce6a-4827-8fe8-f1c3197bff82 account.Js中节点Js中的Api是 router.route('/:user_id').put(function(req, res) { console.log("hello") 当我将路由更改为以下内容
http://localhost:3000/accounts?user_id=62139fbf-ce6a-4827-8fe8-f1c3197bff82
// params
user_id 62139fbf-ce6a-4827-8fe8-f1c3197bff82
account.Js中节点Js中的Api是
router.route('/:user_id').put(function(req, res) {
console.log("hello")
当我将路由更改为以下内容时(即,我删除了params user_id,也从邮递员中删除了params user_id),它就会起作用
router.route('/').put(function(req, res) {
console.log("efwe")
因此,问题在于发送参数是否有任何帮助。我相信您的URL应该是- 对于路由-
router.route('/accounts/:user_id')。
对于查询参数,您需要执行以下操作-
router.route("/accounts",function(req,res){
var id = req.query.user_id; // Check syntax for framework you are using
});