我是新的節點。未定義續集 - 續訂和發貨
我想添加Sequelize在我簡單的應用程序與cosign。
配置/ db.js
var Sequelize = require('sequelize');
var sequelize = new Sequelize('test', 'root', '', {
host: 'localhost',
dialect: 'mysql',
pool: {
max: 5,
min: 0,
idle: 10000
}
});
module.exports = function() {
return sequelize
}
模型/ user.js的
var Sequelize = require('sequelize');
module.exports = function(application, req, res){
var User = sequelize.define('user', {
username: {
type: Sequelize.STRING,
}
}, {
freezeTableName: true // Model tableName will be the same as the model name
});
User.create({ username: 'fnord'})
.then(function() {
console.log('criado!');
})
}
配置/ server.js
...
consign()
.include('app/routes')
.then('config/db.js')
.then('app/models')
.then('app/controllers')
.into(app);
module.exports = app;
,我發現了錯誤sequelize is not defined´ on
VAR用戶= sequelize.define('user',{'
我做錯了什麼?
你是怎麼解決這個問題? –