Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/segment-boneyard/connect-cookies

cookies and keygrip based cookie middleware
https://github.com/segment-boneyard/connect-cookies

Last synced: about 7 hours ago
JSON representation

cookies and keygrip based cookie middleware

Awesome Lists containing this project

README

        

# connect-cookies

[cookies](https://github.com/jed/cookies) and [keygrip](https://github.com/jed/keygrip) based cookie middleware for connect/express.

[![build status](https://secure.travis-ci.org/segmentio/connect-cookies.png)](http://travis-ci.org/segmentio/connect-cookies)

## Example

```js
var cookies = require('connect-cookies');
var connect = require('connect');
var app = connect();

app.use(cookies());

app.use(function(req, res){
var views = req.cookies.get('views') || 0;
req.cookies.set('views', ++views);
res.end(views + ' views');
});

app.listen(3000);
```

## API

### cookies([keys])

Adds an instance of [cookies](https://github.com/jed/cookies) to request and response as `req.cookies` and `res.cookies`. See its [readme](https://github.com/jed/cookies) for api methods.

Pass an array of keys or a [keygrip](https://github.com/jed/keygrip) object to enable secure cookies.

## Installation

```bash
$ npm install connect-cookies
```

## License

MIT