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

135
Views
Heroku not finding endpoint with Express

So I created this local host app I am trying to deploy to Heroku with express and for some reason it works on localhost but not on the Heroku API, getting 502, if someone could help that would be awesome!

app.listen(process.env.PORT || 3000, () => console.log('listening at 3000'));
app.use(express.static('public'));
app.use(express.json({ limit: '5mb' }));
const database = new Datastore('database.db');
database.loadDatabase();
app.get('/api', (request, response) => {
database.find({}, (err, data) => {
if (err) {
  response.end();
  return;
}
response.json(data);
});
});

Wondering why this occurring to be honest, deployed many apps with the same setup and never had it happen like this. The package.json has all the proper NPM packages aswell

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!