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

225
Views
Is there a limit to the number of routes?

Here's my issue with Express.Router. I need these 4 routes to work at the same endpoint "/pets/...":

petRouter.get("/", petController.getAll);
petRouter.get("/:id", petController.getPetById);
petRouter.get("/mypets", verifyToken, petController.getAllUserAdoptions);
petRouter.get("/myadoptions", verifyToken, petController.getAllUserAdoptions);

But whats going on is that I can't use the second one ("/:id") together with the rest. It keeps breaking the server and it gives me this error:

    return new sequelizeErrors.DatabaseError(err);
                   ^
    DatabaseError [SequelizeDatabaseError]: invalid input syntax for type integer: "mypets" 
     ...

And when I use them independently all of them work just fine. Is there any kind of limitation that I'm unaware of?

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

0

The request GET /pets/mypets matches both the second and the third route. In the second route, this leads to req.params.id = "mypets", but petController.getPetById probably assumes that this is an integer. Hence the error that you observed.

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!