I have a query that returns results from my database, but I don't see how I can have it give me results from multiple queries.
router.get("/", function(req, res) {
pg.query("SELECT * from tic", (err, done) => {
if (err) {
console.log(err);
}
res.render("index", { tic: done.rows });
});
});
I was trying along the lines of this, but cant get it to work since he render statement is inside the query and I can get the render to see the results when I move it out of there
router.get("/", function(req, res) {
pg.query("SELECT * from tic", (err, tic) => {
if (err) {
console.log(err);
}
pg.query("SELECT * from tac", (err, tac) => {
if (err) {
console.log(err);
}
});
res.render("index", { tic: tic.rows }, { tac: tac.rows});
});