6 var express
= require('../..');
7 var cookieParser
= require('cookie-parser');
8 var session
= require('express-session');
12 // Required by session() middleware
13 // pass the secret for signed cookies
14 // (required by session())
15 app
.use(cookieParser('keyboard cat'));
17 // Populates req.session
20 app
.get('/', function(req
, res
){
22 if (req
.session
.views
) {
25 req
.session
.views
= 1;
26 body
+= '<p>First time visiting? view this page in several browsers :)</p>';
28 res
.send(body
+ '<p>viewed <strong>' + req
.session
.views
+ '</strong> times.</p>');
32 console
.log('Express app started on port 3000');