Skip to content

Instantly share code, notes, and snippets.

@lyhcode
Created April 30, 2012 10:29
Show Gist options
  • Select an option

  • Save lyhcode/2557146 to your computer and use it in GitHub Desktop.

Select an option

Save lyhcode/2557146 to your computer and use it in GitHub Desktop.
mongoskin + connect-mongodb
var mongo = require('mongoskin')
, db = mongo.db('localhost/collection')
, mongoStore = require('connect-mongodb');
//...
db.open(function(err, db) {
app.configure(function() {
//...
app.use(express.cookieParser());
app.use(express.session({
cookie: {maxAge: 60000 * 30},
secret: 'foo',
store: new mongoStore({db: db})
}));
app.use(app.router);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment