If I have a view in my (mvc project) contains data from many tables in the database, what is the best way to fetch them without getting into the nested tree of doom
Model1.findAll().then(model1Data => {
Model2.findAll().then(model2Data => {
Model3.findAll().then(model3Data => {
Modeln.findAll().then(modelnData => {
res.render('view', {
model1Data: model1Data,
model2Data: model2Data,
model3Data: model3Data,
modelnData: modelnData
});
})
})
})
})
Note: the above query has no where clauses, joins, or any other conditions