@waveorb/cookie
v1.0.1
Published
Server cookie implementation for Node.js
Downloads
155
Readme
Waveorb cookie
Server cookie handling for Node.js
Install
npm i @waveorb/cookie
Usage
This is how you would use it on a server:
// Server setup
var http = require('http')
var cookie = require('@waveorb/cookie')
http.createServer(function (req, res) {
// Enable cookies
cookie(req)
// Get cookie
var name = req.cookie('name')
// Set cookie
req.cookie('name', 'hello')
// Delete cookie
req.cookie('name', null)
// Set response cookie headers
if (req.cookieJar.length) {
res.setHeader('set-cookie', req.cookieJar.headers)
}
}).listen(8124)
Created by Eldøy Projects