Skip to content

Instantly share code, notes, and snippets.

@lezhangxyz
Created October 9, 2011 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lezhangxyz/1273901 to your computer and use it in GitHub Desktop.
Save lezhangxyz/1273901 to your computer and use it in GitHub Desktop.
Volatile authentication sessions..
/* Requires */
// Set up connect-couchdb
var store = new ConnectCouchDB({
// Name of the database for sessions.
name: 'myreci-web-sessions',
// Optional. How often expired sessions should be cleaned up.
// Defaults to 600000 (10 minutes).
reapInterval: 600000,
// Optional. How often to run DB compaction against the session
// database. Defaults to 600000 (10 minutes).
compactInterval: 600000,
// Connection info and credentials
host: dbUrl.hostname,
port: 443,
username: dbUrl.auth[0],
password: dbUrl.auth[1],
ssl: true
});
/* Set up Everyauth here */
// Initialize API services
var app = express.createServer(
express.bodyParser(),
express.cookieParser(),
express.session({secret: cookieSecret, store: store }),
express.logger()
);
// Set up static directories
app.configure(function(){
app.use('/css',express.static(__dirname + '/css'));
app.use('/images',express.static(__dirname + '/images'));
app.use('/js',express.static(__dirname + '/js'));
app.use(everyauth.middleware());
app.use(app.router);
})
// everyauth middleware and view helpers
everyauth.helpExpress(app);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment