Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zakjholt/micro-cookie
A package to parse out request cookies
https://github.com/zakjholt/micro-cookie
Last synced: 2 months ago
JSON representation
A package to parse out request cookies
- Host: GitHub
- URL: https://github.com/zakjholt/micro-cookie
- Owner: zakjholt
- Created: 2017-06-21T18:17:43.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-10-05T05:57:01.000Z (4 months ago)
- Last Synced: 2024-11-10T02:42:55.723Z (3 months ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 3
- Watchers: 2
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-micro - micro-cookie - Cookie parsing for Zeit's Micro. (Modules / Utilities)
README
micro-cookie
cookie parser for zeit's micro
Parses request cookies and puts the object in req.cookies
## Installation
```sh
yarn add micro-cookie
```## Usage
```javascript
const parseCookies = require('micro-cookie')module.exports = parseCookies(async function(req, res) {
return 'Hello World!'
})
```## With other micro plugins
```javascript
const visualize = require('micro-visualize')
const cors = require('micro-cors')
const cookieParse = require('micro-cookie')
const { send } = require('micro')module.exports = visualize(cors(cookieParse(async function(req, res) {
const responseMessage = {
message: 'hello world!',
cookies: req.cookies
}
send(res, 200, responseMessage)
})))
```