0.4.1 • Published 3 years ago

wcookie v0.4.1

Weekly downloads
68
License
MIT
Repository
-
Last release
3 years ago

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.

// Server setup
const http = require('http')
const cookie = require('wcookie')

http.createServer(function (req, res) {
  // Enable cookies
  cookie(req)

  // Get cookie
  const 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!

0.4.1

3 years ago

0.4.0

4 years ago

0.3.0

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago