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

107
Views
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
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!