admin.js
getPortfolio和getSettings
getPortfolio(){
return new Promise((resolve, reject) => {
conn.query(`SELECT * FROM tb_portfolio ORDER BY id`, (err, results) => {
if (err){ reject(err);
} else { resolve(results); }
});
});
},
getSettings(){
...
},
路线:
在同一路径上呈现两个方法的正确方法是什么?
router.get('/', function(req, res, next) {
admin.getPortfolio().then(results => {
res.render("index", { results });
});
});