0
我嘗試讓我的節點mysql安裝程序正常工作。在我的模型event.js我有以下代碼:無法將結果從模型傳遞到索引文件
Event.getEvents = function(results) {
db.query("select * from com_event_details where type='featured'", function(error, results, fields) {
return results;
});
};
在我index.js我嘗試從getEvents返回結果。
app.get('/', function(req, res) {
Event.getEvents(function(results) {
res.send(results);
});
});
不幸的是,這是行不通的。不知何故,我無法將模型的結果傳遞給索引文件。
感謝您的幫助。