what I am sending is
http://localhost:3000/accounts?user_id=62139fbf-ce6a-4827-8fe8-f1c3197bff82
// params
user_id 62139fbf-ce6a-4827-8fe8-f1c3197bff82
My Api in node Js inside account.js is
router.route('/:user_id').put(function(req, res) {
console.log("hello")
It works when I change the route to the following( ie I remove the params user_id and also from the postman.
router.route('/').put(function(req, res) {
console.log("efwe")
So the problem is with sending params any help.
I believe your URL should be like -
http://localhost:3000/accounts/62139fbf-ce6a-4827-8fe8-f1c3197bff82
for route - router.route('/accounts/:user_id').
For query parameters you need to do something like this - http://localhost:3000/accounts?user_id=62139fbf-ce6a-4827-8fe8-f1c3197bff82
router.route("/accounts",function(req,res){
var id = req.query.user_id; // Check syntax for framework you are using
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.