Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
express PUT shows cannot PUT error

I have this in my express

router.put('/admin/profile?:id/actions', (req, res) => {
console.log(req.body.actions)
});

and in postman I do a PUT request

http://localhost:3000/api/admin/58fb442234c93715b435395/actions

with actions as key like

actions:approve

but I get cannot PUT error? I'm expecting 'approve' in my node's console.

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Your route might be wrong. As far as I understand the express.js documentation on route paths, as long as your :id-parameter does not start with either profil or profile, your route will not be called.

Remove the profile? from your path.

about 4 years ago · Santiago Trujillo Report

0

try the following in postman as you are sending data in params so the name of action is requires as approve/disapprove

http://localhost:3000/api/admin/58fb442234c93715b435395/approve

if you want to send the key name as well so use query params like

http://localhost:3000/api/admin/58fb442234c93715b435395?action=approve

router.put('/admin/profile?:id/actions',

change your router.put to

router.put('/admin/profile/:id/:actions',
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!