Skip to content

Instantly share code, notes, and snippets.

@xjamundx
Created February 3, 2011 22:10
Show Gist options
  • 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