Skip to content

Instantly share code, notes, and snippets.

@yanCode
Forked from tj/app.js
Last active December 19, 2015 11:29
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 yanCode/5948505 to your computer and use it in GitHub Desktop.
Save yanCode/5948505 to your computer and use it in GitHub Desktop.
var express = require('express')
, cookieSessions = require('./cookie-sessions');
var app = express();
app.use(express.cookieParser('manny is cool'));
app.use(cookieSessions('sid'));
app.get('/', function(req, res){
req.session.count = req.session.count || 0;
var n = req.session.count++;
res.send('viewed ' + n + ' times\n');
})
app.listen(3000);
@yanCode
Copy link
Author

yanCode commented Jul 8, 2013

Fixed a bug from the original, which is more likely a typo, yet it blocked the startup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment