Skip to content

Instantly share code, notes, and snippets.

@xjamundx
Created February 3, 2011 22:10
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 xjamundx/810330 to your computer and use it in GitHub Desktop.
Save xjamundx/810330 to your computer and use it in GitHub Desktop.
expressjs cookie fail
//express server creation
var app = express.createServer()
var MemoryStore = require('connect/middleware/session/memory')
// configuration
app.configure(function() {
app.use(express.cookieDecoder());
app.use(express.session({
secret:"HAHAHHAHAHAHAHAHAH"
}))
})
var count = 0;
app.get('/sesh', function(request, response) {
count++;
request.session.visitCount = request.session.visitCount ? request.session.visitCount + 1 : 1;
response.send('You have visited this page ' + request.session.visitCount + ' times. Or was it ' + count + '?');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment