Created
August 12, 2010 16:37
-
-
Save xrd/521251 to your computer and use it in GitHub Desktop.
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
require.paths.unshift("./lib"); | |
var Connect = require('connect'); | |
var sys = require('sys'); | |
var MemoryStore = require('connect/middleware/session/memory'); | |
function handleLogin( json, req, res, next ) { | |
sys.puts( "In handle login" ); | |
req.sessionStore.regenerate(req, function(err){ | |
req.session.profile = json.profile; | |
req.session.username = json.profile.displayName; | |
next(); | |
}); | |
} | |
// One minute | |
var minute = 60000; | |
var expireDuration = minute * 60 * 3; // 3 hours | |
var memory = new MemoryStore({ reapInterval: minute, maxAge: expireDuration }); | |
var Server = module.exports = Connect.createServer( | |
Connect.logger() | |
, Connect.bodyDecoder() | |
, Connect.cookieDecoder() | |
, Connect.session({ store: memory, secret : '123s123dasdad' }) | |
); | |
var rails = require( './rails' ); | |
rails.setProxy( 'localhost', 8181 ); | |
Server.use( '/', rails.handler ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment