I am currently creating a Keystone.js project and you need to use Express.js with it. Since Keystone.js is built on top of Express.js, it seemed like it would be pretty easy, but I have a lot of problems when everything works.
Here is what I'm trying now (this is my best guess as to the correct way to do this):
In my file keystone.js(the main entry point of the application) I insert the following code immediately before keystone.start():
keystone.app.use(stormpath.init(keystone.app, {
...
}));
The bit keystone.app.use(...);is important here - I took a look at the source of Keystone.js and it seems that the main object of the Express.js application is displayed as keystone.app, so I'm trying to use it that way.
Unfortunately, while my Keystone web server starts at startup $ node keystone.js, an attempt to load any page on my site results in the following exception:
$ node keystone.js
------------------------------------------------
KeystoneJS Started:
keystone is ready on port 3000
------------------------------------------------
TypeError: Object
at doSignin (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/lib/session.js:38:15)
at Promise.<anonymous> (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/lib/session.js:72:5)
at Promise.<anonymous> (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:177:8)
at Promise.EventEmitter.emit (events.js:95:17)
at Promise.emit (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:84:38)
at Promise.fulfill (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:97:20)
at Promise.resolve (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/lib/promise.js:114:23)
at Promise.<anonymous> (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:177:8)
at Promise.EventEmitter.emit (events.js:95:17)
at Promise.emit (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:84:38)
at Promise.fulfill (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:97:20)
at /Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/lib/query.js:1400:13
at model.Document.init (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/lib/document.js:250:11)
at completeOne (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/lib/query.js:1398:10)
at Object.cb (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/lib/query.js:1155:11)
at Object._onImmediate (/Users/rdegges/Dropbox/Code/testing/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mquery/lib/utils.js:137:16)
I have MongoDB working locally just fine, and if I comment on my code above everything works as expected, so I know this is the main reason.
Any help would be appreciated.
source
share