I am starting to work in Node.js, and I am completely confused about why I cannot get the results of my SQL query for rendering on the page.
connection.query('SELECT * FROM testTable', function selectCb(err, rows, fields) { if (err) { throw err; } for (var i in rows) { console.log(rows[i]); } res.render('showResults.jade', { results: rows }); });
The results are displayed perfectly in the console, but when I try to display them using Jade, I get a few bullet points (equal to the number of entries in the table), but each of them follows the object [object, Object], This is my Jade file:
h1 SQL Results are as follows: ul each item, i in results li= item
Is there an extra step or something I need to display the results correctly?
source share