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

108
Visualizações
Where are relative route paths made accessible on an express api?

When using express, I often make the mistake of registering route handlers with relative paths:

const tagRoutes = require('./app/routes/tag.js');
app.use("api/tag", tagRoutes); // Should be "/api/tag"

Those routes are then inaccessible at /api/tag. But then where are they accessible?

The express path examples docs don't show an example for relative paths; they all begin with a /. This makes me wonder why not just preface every route with / if it isn't already.

When I turn on debugging for express, I see this:

...
express:router use 'api/tag' router +0ms
express:router:layer new 'api/tag' +0ms
...
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