Skip to content

Instantly share code, notes, and snippets.

@biggora
Created January 19, 2014 18:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biggora/8508814 to your computer and use it in GitHub Desktop.
Save biggora/8508814 to your computer and use it in GitHub Desktop.
Add session store in TrinteJS
/**
* Default session configuration
* Inject app and express reference
*
* Created by init script
* App based on TrinteJS MVC framework
* TrinteJS homepage http://www.trintejs.com
**/
var config = require('./configuration');
var CaminteStore = require('connect-caminte');
var database = require('./database' ).db;
module.exports = function (app,express) {
var sessionStore = CaminteStore(express);
app.configure(function () {
app.use(express.session({
cookie: {
maxAge: config.session.maxAge
},
key: config.session.key,
secret: config.session.secret,
store: new sessionStore({
driver: database.driver,
collection: 'session',
db: database,
secret: config.session.secret,
maxAge: config.session.maxAge,
clear_interval: config.session.clear_interval
})
}));
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment