diff --git a/config/express.js b/config/express.js index 0a2d2a291b..e650838001 100755 --- a/config/express.js +++ b/config/express.js @@ -7,7 +7,7 @@ var express = require('express'), helpers = require('view-helpers'), config = require('./config'); -module.exports = function(app, passport) { +module.exports = function(app, passport, db) { app.set('showStackError', true); //Should be placed before express.static @@ -46,7 +46,7 @@ module.exports = function(app, passport) { app.use(express.session({ secret: 'MEAN', store: new mongoStore({ - url: config.db, + db: db.connection.db, collection: 'sessions' }) })); @@ -87,4 +87,4 @@ module.exports = function(app, passport) { }); }); -}; \ No newline at end of file +}; diff --git a/server.js b/server.js index 10f7cff57a..ebc08a8906 100755 --- a/server.js +++ b/server.js @@ -44,7 +44,7 @@ require('./config/passport')(passport); var app = express(); //express settings -require('./config/express')(app, passport); +require('./config/express')(app, passport, db); //Bootstrap routes require('./config/routes')(app, passport, auth); @@ -58,4 +58,4 @@ console.log('Express app started on port ' + port); logger.init(app, passport, mongoose); //expose app -exports = module.exports = app; \ No newline at end of file +exports = module.exports = app;