sac Dahal sac Dahal - 9 months ago 36
Javascript Question

Not able to send put request with postman

what I am sending is

// 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) {

It works when I change the route to the following( i.e I remove the params user_id and also from the postman.

router.route('/').put(function(req, res) {

So the problem is with sending params any help.

Answer Source

I believe your URL should be like -


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

    var id = req.query.user_id; // Check syntax for framework you are using