-2
I’m starting in Node.js and I did a Crud, and I’m trying to return a query to my homepage, but I couldn’t find documentation to save this Count and take it there. (I preferred not to use the sequelize
initially).
I can already have the value in the log.
app.get("/",function(req,res){
sql.query({sql: 'SELECT COUNT(*) AS count FROM clientes where idstatus="Critico"'}, function (err, criticos) {
console.log(criticos[0].count + ' Criticos');
});
sql.query({sql: 'SELECT COUNT(*) AS count FROM clientes where idstatus="Em Implantação"'}, function (err, emimp) {
console.log(emimp[0].count + ' Em Implantação');
});
sql.query({sql: 'SELECT COUNT(*) AS count FROM clientes where idstatus="Paralisado"'}, function (err, paral) {
console.log(paral[0].count + ' Pralisados');
});
sql.query({sql: 'SELECT COUNT(*) AS count FROM clientes where idstatus="Não iniciado"'}, function (err, naoini) {
console.log(naoini[0].count + ' Não iniciados');
});
});