Skip to content
Myr

app.js

This file

Path

examples/session/app.js

32 lines · 681 bytes · JavaScript

Last changed by

Merge branch 'features/cookie'Tj Holowaychukbefore adoption6521d2b

History of this file

Take it

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

Misc refactoring of github exampleTj Holowaychukbefore adoption4ee5c59

lines 1–5why, one step back
1
2/**3 * Module dependencies.4 */5

Updated examples to use express.<middleware>Tj Holowaychukbefore adoption90a1a2f

line 6why, one step back
6var express = require('./../../lib/express');

Misc refactoring of github exampleTj Holowaychukbefore adoption4ee5c59

lines 7–8why, one step back
7
8var app = express.createServer(

Updated examples to use express.<middleware>Tj Holowaychukbefore adoption90a1a2f

line 9why, one step back
9 express.logger(),

Misc refactoring of github exampleTj Holowaychukbefore adoption4ee5c59

lines 10–11why, one step back
10
11 // Required by session() middleware

Updated examples to use express.<middleware>Tj Holowaychukbefore adoption90a1a2f

line 12why, one step back
12 express.cookieDecoder(),

Misc refactoring of github exampleTj Holowaychukbefore adoption4ee5c59

lines 13–16why, one step back
13
14 // Populates:15 // - req.session16 // - req.sessionStore

Merge branch 'features/cookie'Tj Holowaychukbefore adoption6521d2b

line 17why, one step back
17 // - req.sessionID

Updated examples to use express.<middleware>Tj Holowaychukbefore adoption90a1a2f

line 18why, one step back
18 express.session()

Misc refactoring of github exampleTj Holowaychukbefore adoption4ee5c59

lines 19–32why, one step back
19);
2021app.get('/', function(req, res){22 var body = '';23 if (req.session.views) {24 ++req.session.views;25 } else {26 req.session.views = 1;27 body += '<p>First time visiting? view this page in several browsers :)</p>';28 }29 res.send(body + '<p>viewed <strong>' + req.session.views + '</strong> times.</p>');30});3132app.listen(3000);