I am trying to pass several data to one view. I can send the products to it but I would like to send the categories as well. I want to send them separately and not with a join. I have been advised to put it after the “then” but I don’t know how to do it.
router.get('/', function (req, res) {
models.produit.findAll(
{
include:
[
{
model: models.image, as: "images"
},
{
model: models.promotionproduit, as: "promotionproduits",
include:[{model: models.promotion, as: "Promotion"}]
}
]})
.then(data => {
res.render('home', {
data: data
});
}).catch(err => console.log(err));
});