Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/segment-boneyard/connect-cookies
- Owner: segment-boneyard
- Created: 2014-01-15T21:08:58.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-01-30T10:06:24.000Z (almost 11 years ago)
- Last Synced: 2024-08-08T18:56:22.039Z (3 months ago)
- Language: JavaScript
- Size: 131 KB
- Stars: 4
- Watchers: 41
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
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