router.get('/', function (req, res, next) {
let data = {};
connection.query("SELECT * FROM hc_posts ORDER BY id DESC LIMIT 10", function (err, result, fields) {
if (err) throw err;
data.posts = result;
connection.query("SELECT COUNT(*) FROM hc_posts", function (err, result, fields) {
if (err) throw err;
data.amount = result[0]['COUNT(*)'] + 1;
res.render('index', { data: data });
});
});
});