Skip to content

Commit 0e3ab6e

Browse files
Dmitry-Kondardougwilson
authored andcommitted
examples: improve view count in cookie-sessions
closes #5414
1 parent 59af63a commit 0e3ab6e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

examples/cookie-sessions/index.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,10 @@ var app = module.exports = express();
1313
app.use(cookieSession({ secret: 'manny is cool' }));
1414

1515
// do something with the session
16-
app.use(count);
17-
18-
// custom middleware
19-
function count(req, res) {
16+
app.get('/', function (req, res) {
2017
req.session.count = (req.session.count || 0) + 1
2118
res.send('viewed ' + req.session.count + ' times\n')
22-
}
19+
})
2320

2421
/* istanbul ignore next */
2522
if (!module.parent) {

0 commit comments

Comments
 (0)