DEV Community

Discussion on: Docker-compose an express and mongo App

Collapse
 
tommazo profile image
Tom Mazo

Exactly what I was looking for, thanks!

Maybe I missed something, but I think you forgot to mention that you need to fetch the items from the DB to display them in the index route.

Something like that:

app.get("/", (req, res) => {
  Item.find((err, items) => {
    if (err) throw err;
    res.render("index", { items });
  });
});
Collapse
 
jay97 profile image
Jamal Al

Glad it helped and you're absolutely correct. I'll fix it as soon as I get time