Closed tratnayake closed 8 years ago
Figured it out (if anyone arrives on this same issue sometime later). The code snippet above (app.use with model definitions) needs to be posted BEFORE the router is called in the app.js.
This is also mentioned in the orm2 documentation however I skimmed over that part and missed it.
Hello all. If I have the following in my app.js of my express app:
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)