mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 12:19:51 +01:00
parent
59af63ac2e
commit
0e3ab6ec21
|
|
@ -13,13 +13,10 @@ var app = module.exports = express();
|
||||||
app.use(cookieSession({ secret: 'manny is cool' }));
|
app.use(cookieSession({ secret: 'manny is cool' }));
|
||||||
|
|
||||||
// do something with the session
|
// do something with the session
|
||||||
app.use(count);
|
app.get('/', function (req, res) {
|
||||||
|
|
||||||
// custom middleware
|
|
||||||
function count(req, res) {
|
|
||||||
req.session.count = (req.session.count || 0) + 1
|
req.session.count = (req.session.count || 0) + 1
|
||||||
res.send('viewed ' + req.session.count + ' times\n')
|
res.send('viewed ' + req.session.count + ' times\n')
|
||||||
}
|
})
|
||||||
|
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
if (!module.parent) {
|
if (!module.parent) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user