Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

165
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda