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

197
Visualizações
Get request not found, attempt to set ?value parameters inside a url

I did this get, with the intention of returning the amount of clients that the application needed, but insomnia only returns that it didn't find the route:

server.get('/consultclients?amount=1', (req,res) =>{
let amount = req.params.amount;

return res.json({amount})
})

Request insomnia: localhost:3003/consultclients?amount=10

I tried with a method that I used to search for an id, but I don't think it's the right method to use, even though it works:

server.get('/consultclients/:amount', (req,res) =>{
let amount = req.params.amount;

return res.json({amount})
})

Request insomnia: localhost:3003/consultclients/10

about 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Try the base path .get('/consultclients', …), and then see if req.query.amount (req.query instead of req.params) is populated when you make your request.

about 4 years ago · Santiago Trujillo Relatório

0

You are trying to access the search params. You can find them in the req.query in the request object instead of the req.params

This code example should work for you:

server.get('/consultclients', (req,res) =>{
  let amount = req.query.amount;

  return res.json({amount})
})
about 4 years ago · Santiago Trujillo 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