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

194
Visualizações
Express route not working but deliberate error in code shows it is being called correctly

I have a very strange problem with an Express route whereby a perfectly valid console.log does not display and no other lines of code after it execute when the route is hit.

For example:

app.get('/api/v1/users', (req, res) => {
   console.log('Users route has been reached....') // does not display in console
   ...
  // No other code executes
}

However, to test if the route is actually being hit I purposely created an error in the console.log like so:

console.log('Route has been reached....) // missing end quote

And when I check the logs, I can see the following error.

0|index | /home/ubuntu/apps/api/server/index.js:119 0|index | console.log('Route has been reached........) 0|index | ^^^^^^^^^^^^^^^^^^^^^^^ 0|index | 0|index | SyntaxError: Invalid or unexpected token

This must mean that the route is being hit correctly but for some reason doesn't execute its request properly. My logic is that if the line with the bad console.log is reached then I cannot see why the correct one doesn't even log out at all.

I am a bit stumped as to what is going on so any ideas or assistance on what the problem could be is very welcome.

Thanks!

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