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

180
Views
Correct way to write a params api in node js

app.post('/scripts/:freezeId', scriptsView.findAll);

app.post('/scripts/deleteScripts', scriptsView.deleteconfig);

Is the only way the second API needs to write on top of the params API or any other ideas are available in node js

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Express tries to match routes in order.

So, typically, the URL /scripts/deleteScripts will match '/scripts/:freezeId' and run scriptsView.findAll. Then scriptsView.findAll will send a response and end the handling of that request.

Now, scriptsView.findAll could special case deleteScripts and call next() instead, but that means scriptsView.findAll has to know about things outside its remit.

Changing the order so '/scripts/deleteScripts', is tested first is clearer.

about 4 years ago · Juan Pablo Isaza Report

0

Instead of app.post you can use app.delete for delete scripts API

about 4 years ago · Juan Pablo Isaza 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!