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

164
Views
Heroku "Cannot GET /" when getting data from MongoDB through Heroku API using MEN Stack

JS Express server and Heroku API hosting.

I created a backend that allows me to Post and Get data from MongoDB through Express server that is hosted on Heroku, I'm using Postman for testing.

POST method works well both locally and on Heroku.

GET method only works locally and I get a Cannot GET / error with a 404 code when I test on Heroku.

This is my code below:

router.get('/posts', async (req, res) => {
    try {
        const posts = await Posts.find();
        res.json(posts)
        console.log('data',res.send)
    }catch (err) {
        res.send('error', err)
    }
});

module.exports = router;
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!