Saturday 9 January 2016

node orm2 express middleware?

Hello all.If I have the following in my app.js of my express app:EDIT: I've provided a gist because no matter how much I try to embed code in a post using the 4 spaces of indent, it always show's up horribly like it looks below: http://ift.tt/1kWPsQq(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: http://ift.tt/1Rtat3V and demonstrated in: http://ift.tt/1kWPrfs 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)

Submitted January 10, 2016 at 05:27AM by TLI5

No comments:

Post a Comment