1) You probably using passport.session
, which has a dependency upon express.session
being loaded. If so, you have a block that looks like this someplace:
app.configure(function() {
app.use(express.static('public'));
app.use(express.cookieParser());
app.use(express.bodyParser());
app.use(express.session({ secret: 'keyboard cat' }));
app.use(passport.initialize());
app.use(passport.session());
app.use(app.router);
});
2) express.session
is no longer part of the express core app. To get sessions with Express v4, you can use the 'new' express-session to keep things relatively continuous.
In a v4 app, you'll need to require the new express-session
module and then use it in place of the original express.session
. The modified code would look a little like this:
var express = require('express')
var session = require('express-session')
var app = express()
app.use(session({secret: 'keyboard cat'}))
The express-session
page (linked above) includes additional information on how to work with the module.
The bottom line: if you are building an Express v4 app while using examples that were written in Express v3, you'll want to carefully read the docs about the differences between Express versions and how to upgrade. Most examples/docs out there assume Express v3, so you'll need to really understand these: