Skip to content

Commit

Permalink
use mongo session store
Browse files Browse the repository at this point in the history
  • Loading branch information
madhums committed Nov 24, 2015
1 parent 7a758df commit df312bb
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions config/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ module.exports = function (app, passport) {
// CookieParser should be above session
app.use(cookieParser());
app.use(cookieSession({ secret: 'secret' }));
app.use(session({
resave: true,
saveUninitialized: true,
secret: pkg.name,
store: new mongoStore({
url: config.db,
collection : 'sessions'
})
}));

// use passport session
app.use(passport.initialize());
Expand All @@ -100,16 +109,6 @@ module.exports = function (app, passport) {
app.use(helpers(pkg.name));

if (env !== 'test') {
app.use(session({
resave: true,
saveUninitialized: true,
secret: pkg.name,
store: new mongoStore({
url: config.db,
collection : 'sessions'
})
}));

app.use(csrf());

// This could be moved to view-helpers :-)
Expand Down

0 comments on commit df312bb

Please sign in to comment.