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

182
Views
Cannot get api/path in express

When i try to get /api/file i get status code 404.

Here is my code :

app.js :

...
app.use("/api", require("./routes/users"));
app.use("/api", require("./routes/file"));
app.use("/", require("./routes/login"));
...

routes/file :

...
route.get("/file/:filename", fileController.getFile);
...

module.exports = route;

Here's what I get in postman

postman result

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

route.get("/file/:filename", fileController.getFile)

You are using the :filename, which is a param - but in your postman request you are looking for a query ?filename=.

Also you are trying to export your routes, using the MVC. You have to use router

const router = express.Router()

router.get('/api..')

module.exports = router;
over 4 years ago · Santiago Trujillo Report
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!