Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eldoy/wcookie
Server and browser cookie handling
https://github.com/eldoy/wcookie
Last synced: 6 days ago
JSON representation
Server and browser cookie handling
- Host: GitHub
- URL: https://github.com/eldoy/wcookie
- Owner: eldoy
- Created: 2019-10-16T16:29:00.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-08-01T01:17:08.000Z (4 months ago)
- Last Synced: 2024-08-02T04:07:22.918Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 243 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Wcookie
Server cookie handling for Node.js.### Install
```
npm i wscookie
```### Usage
Check out `server.js` in the source code for a running server example.
```js
// Server setup
var http = require('http')
var cookie = require('wcookie')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)
```
ISC licensed. Enjoy!Created by [Eldøy Projects](https://eldoy.com)