Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

229
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda