connect-cookies

cookies and keygrip based cookie middleware

connect-cookies

cookies and keygrip based cookie middleware for connect/express.

var cookies = require('connect-cookies');
var connect = require('connect');
var app = connect();
 
app.use(cookies());
 
app.use(function(reqres){
  var views = req.cookies.get('views') || 0;
  req.cookies.set('views', ++views);
  res.end(views + ' views');
});
 
app.listen(3000);

Adds an instance of cookies to request and response as req.cookies and res.cookies. See its readme for api methods.

Pass an array of keys or a keygrip object to enable secure cookies.

$ npm install connect-cookies

MIT