Archived
1
0
Fork 0
This repository has been archived on 2019-02-05. You can view files and clone it, but cannot push or open issues or pull requests.
Pong/node_modules/cookie
2017-01-20 23:42:49 +01:00
..
.npmignore Initial commit 2017-01-20 23:42:49 +01:00
index.js Initial commit 2017-01-20 23:42:49 +01:00
LICENSE Initial commit 2017-01-20 23:42:49 +01:00
package.json Initial commit 2017-01-20 23:42:49 +01:00
README.md Initial commit 2017-01-20 23:42:49 +01:00

cookie Build Status

cookie is a basic cookie parser and serializer. It doesn't make assumptions about how you are going to deal with your cookies. It basically just provides a way to read and write the HTTP cookie headers.

See RFC6265 for details about the http header for cookies.

how?

npm install cookie
var cookie = require('cookie');

var hdr = cookie.serialize('foo', 'bar');
// hdr = 'foo=bar';

var cookies = cookie.parse('foo=bar; cat=meow; dog=ruff');
// cookies = { foo: 'bar', cat: 'meow', dog: 'ruff' };

more

The serialize function takes a third parameter, an object, to set cookie options. See the RFC for valid values.

path

cookie path

expires

absolute expiration date for the cookie (Date object)

maxAge

relative max age of the cookie from when the client receives it (seconds)

domain

domain for the cookie

secure

true or false

httpOnly

true or false