Skip to content
Myr

app.js

This file

Path

examples/session/app.js

36 lines · 838 bytes · JavaScript

Last changed by

fixing more examplesTj Holowaychukbefore adoptionb70bde5

History of this file

Take it

The walk stopped after 200 commits: lines older than a9db47f point at it.

Updated connect submoduleTj Holowaychukbefore adoptiona9db47f

line 1why, one step back
1

Added vhost exampleTj Holowaychukbefore adoption9e9c3ee

lines 2–4why, one step back
2// Expose modules in ./support for demo purposes
3require.paths.unshift(__dirname + '/../../support');4

Updated connect submoduleTj Holowaychukbefore adoptiona9db47f

lines 5–14why, one step back
5/**
6 * Module dependencies.7 */89var express = require('../../lib/express');1011var app = express.createServer(12 express.logger(),1314 // Required by session() middleware

fixing more examplesTj Holowaychukbefore adoptionb70bde5

line 15why, one step back
15 express.cookieParser(),

Updated connect submoduleTj Holowaychukbefore adoptiona9db47f

lines 16–19why, one step back
16
17 // Populates:18 // - req.session19 // - req.sessionStore

fixed session example/tests due to connect changesTj Holowaychukbefore adoptionb1004b6

lines 20–21why, one step back
20 // - req.sessionID (or req.session.id)
21 express.session({ secret: 'keyboard cat' })

Updated connect submoduleTj Holowaychukbefore adoptiona9db47f

lines 22–36why, one step back
22);
2324app.get('/', function(req, res){25 var body = '';26 if (req.session.views) {27 ++req.session.views;28 } else {29 req.session.views = 1;30 body += '<p>First time visiting? view this page in several browsers :)</p>';31 }32 res.send(body + '<p>viewed <strong>' + req.session.views + '</strong> times.</p>');33});3435app.listen(3000);36console.log('Express app started on port 3000');