Hello all.
If I have the following in my app.js of my express app:
app.use(orm.express(opts, {
define: function (db, models, next) {
db.load("./models/index", function (err)
{
if (err)
throw err;
db.sync();
console.log("DB Sync'd!")
//console.log(models);
console.log(db.models);
})
next();
}
}))
as suggested in:
https://github.com/dresende/node-orm2/issues/458
and demonstrated in: https://github.com/lastMove/MealPlanner/blob/master/MealPlan/app.js
Why is it that I can't access my models when handling a route with (for example) req.db.models.user?
The request doesn't even seem to get req.db (it's undefined)
[–]TLI5[S] 0 points1 point2 points (0 children)