0
的NodeJS
var orm = require('orm');
app.use(orm.express("mysql://[email protected]/daat", {
define: function (db, models, next) {
var question_model = db.define('question', {
title : { type: "text" }
}, {
methods : {
fullName: function() {
return this.title;
}
}
});
models.question = question_model;
next();
}
}));
和路線是純
app.get("/", function (req, res) {
req.models.question.find({id: 4}, function(err, question) {
console.log(question);
});
});
,我得到了一個未定義的輸出。
是否有錯誤? '的console.log(ERR);' – loganfsmyth
該死:-)就是這樣,錯誤的表的名字 - 忘了 'S'。感謝@loganfsmyth – WebQube