Created
October 9, 2011 16:47
-
-
Save lezhangxyz/1273901 to your computer and use it in GitHub Desktop.
Volatile authentication sessions..
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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