I'm using ExpressJS and have been trying to get PassportJS working. In my express.js
config, I have the following:
app.configure(function () {
// dynamic helpers
app.use(helpers(config.app.name));
// cookieParser should be above session
app.use(express.cookieParser());
// bodyParser should be above methodOverride
app.use(express.bodyParser());
app.use(express.methodOverride());
// express/mongo session storage
app.use(express.session({
secret: 'noobjs',
store: new mongoStore({
url: config.db,
collection : 'sessions'
})
}));
// connect flash for flash messages
app.use(flash());
// use passport session
app.use(passport.initialize());
app.use(passport.session());
...
Unfortunately, I get the following error when I run the app:-
store.on('disconnect', function(){ storeReady = false; });
^
TypeError: Object #<Object> has no method 'on'
I think it has something to do with initialization order, but am too inexperienced around express to know what the order should be.
Can anyone offer some direction please?