mirror of
https://github.com/cupcakearmy/koa-cookie.git
synced 2024-12-22 08:06:27 +00:00
Update Readme
This commit is contained in:
parent
039b7fb6d0
commit
57f260c1bb
16
README.md
16
README.md
@ -5,20 +5,20 @@ Koa Cookie Utility
|
||||
```javascript
|
||||
const
|
||||
Koa = require('koa'),
|
||||
router = require('koa-simple-router'),
|
||||
router = require('koa-simple-router'),
|
||||
cookie = require('cca-koa-cookie')
|
||||
|
||||
const
|
||||
const
|
||||
app = new Koa(),
|
||||
port = 3000
|
||||
|
||||
// Parse Parameters
|
||||
app.use(require(cookie))
|
||||
|
||||
// Parse Parameters
|
||||
app.use(cookie)
|
||||
|
||||
app.use(router({}, _ => {
|
||||
_.get('/set', (c, n) => {
|
||||
|
||||
// Set a cookie
|
||||
|
||||
// Set a cookie
|
||||
c.request.cookie.set({
|
||||
key: 'my_id',
|
||||
value: '12345678',
|
||||
@ -27,7 +27,7 @@ app.use(router({}, _ => {
|
||||
httpOnly: true,
|
||||
secure: false
|
||||
})
|
||||
|
||||
|
||||
c.body = [200, 'Cookie Set']
|
||||
})
|
||||
|
||||
|
@ -3,9 +3,6 @@
|
||||
"version": "0.1.0",
|
||||
"description": "Cookie Parser and Setter for Koa",
|
||||
"main": "Cookie.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/CupCakeArmy/koa-cookie.git"
|
||||
@ -21,4 +18,4 @@
|
||||
"url": "https://github.com/CupCakeArmy/koa-cookie/issues"
|
||||
},
|
||||
"homepage": "https://github.com/CupCakeArmy/koa-cookie#readme"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user