-2
Problem:
I am developing an application in Nodejs + Express and I have reached a stage where I need to pass several queries to the database by a single route.
NOTE: I use the Sequelize ORM to perform these tasks with the bank and I don’t have much knowledge with default or asynchronous functions.
below follows the code I tried to implement, but it did not work:
app.get('/monitoramento', eUsuario, (req, res) => {
Bloco2.findAll({limit: 1, order: [['updatedAt', 'desc']]}) +
Bloco1.findAll({limit: 1, order: [['updatedAt', 'desc']]}).then((bloco1, bloco2) => {
res.render('monitoramento', {bloco1: bloco1, bloco2: bloco2})
}).catch((err) => {
req.flash('error_msg', 'Não foi possível listar dados.')
res.redirect('/homepage')
})
})
someone can help me?
thank you very much solved here!
– Teuuz1994