ReferenceError: app_name is not defined
at module.exports (/home/vagrant/host/nodejs/Appstore/models/app.js:11:54)
at setup (/home/vagrant/host/nodejs/Appstore/models/index.js:10:21)
at /home/vagrant/host/nodejs/Appstore/models/index.js:26:9
at Handshake._callback (/home/vagrant/host/nodejs/Appstore/node_modules/orm/lib/ORM.js:130:13)
at Handshake.Sequence.end (/home/vagrant/host/nodejs/Appstore/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24)
at Handshake.Sequence.OkPacket (/home/vagrant/host/nodejs/Appstore/node_modules/mysql/lib/protocol/sequences/Sequence.js:105:8)
at Protocol._parsePacket (/home/vagrant/host/nodejs/Appstore/node_modules/mysql/lib/protocol/Protocol.js:271:23)
at Parser.write (/home/vagrant/host/nodejs/Appstore/node_modules/mysql/lib/protocol/Parser.js:77:12)
at Protocol.write (/home/vagrant/host/nodejs/Appstore/node_modules/mysql/lib/protocol/Protocol.js:39:16)
at Socket. (/home/vagrant/host/nodejs/Appstore/node_modules/mysql/lib/Connection.js:82:28)
{
id: {type: 'serial', key: true},
app_name: {type: 'text', size: 128}
},
{
validations: {
app_name: orm.enforce.notEmptyString(app_name)
}
});
if (err) {
return next(err);
} else {
return res.response('ok', 200);
}
});
According to 'https://github.com/dresende/node-orm2/wiki/Model-Validations', I should get error from callback function, but I can't get error from param 'err', The NodeJS App crash like:
ReferenceError: app_name is not defined at module.exports (/home/vagrant/host/nodejs/Appstore/models/app.js:11:54) at setup (/home/vagrant/host/nodejs/Appstore/models/index.js:10:21) at /home/vagrant/host/nodejs/Appstore/models/index.js:26:9 at Handshake._callback (/home/vagrant/host/nodejs/Appstore/node_modules/orm/lib/ORM.js:130:13) at Handshake.Sequence.end (/home/vagrant/host/nodejs/Appstore/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24) at Handshake.Sequence.OkPacket (/home/vagrant/host/nodejs/Appstore/node_modules/mysql/lib/protocol/sequences/Sequence.js:105:8) at Protocol._parsePacket (/home/vagrant/host/nodejs/Appstore/node_modules/mysql/lib/protocol/Protocol.js:271:23) at Parser.write (/home/vagrant/host/nodejs/Appstore/node_modules/mysql/lib/protocol/Parser.js:77:12) at Protocol.write (/home/vagrant/host/nodejs/Appstore/node_modules/mysql/lib/protocol/Protocol.js:39:16) at Socket. (/home/vagrant/host/nodejs/Appstore/node_modules/mysql/lib/Connection.js:82:28)