O'Reilly logo
  • Patrick S thinks this is interesting:

app.get('/cookies', function(req, res){
  if (!req.cookies.counter)
    res.cookie('counter', 0);
  else
    res.cookie('counter', parseInt(req.cookies.counter,10) + 1);
  res.status(200).send('cookies are: ', req.cookies);
})

Image Tip  The

From

Cover of Pro Express.js

Note

req.cookies() and parseInt() example