mirror of
https://github.com/cupcakearmy/koa-cookie.git
synced 2024-12-22 08:06:27 +00:00
Changed to cca-koa-router
This commit is contained in:
parent
e14e97a4e9
commit
957c20e89a
11
README.md
11
README.md
@ -5,14 +5,13 @@ Lightweight Koa-Middleware for Cookies
|
||||
```javascript
|
||||
const
|
||||
Koa = require('koa'),
|
||||
router = require('koa-simple-router'),
|
||||
cookie = require('cca-koa-cookie')
|
||||
cookie = require('cca-koa-cookie'),
|
||||
router = require('cca-koa-router')
|
||||
|
||||
const
|
||||
app = new Koa(),
|
||||
port = 3000
|
||||
|
||||
// Parse Parameters
|
||||
app.use(cookie)
|
||||
|
||||
app.use(router({}, _ => {
|
||||
@ -28,11 +27,11 @@ app.use(router({}, _ => {
|
||||
secure: false
|
||||
})
|
||||
|
||||
c.body = [200, 'Cookie Set']
|
||||
c.body = 'Cookie Set'
|
||||
})
|
||||
|
||||
_.get('/get', (c, n) => {
|
||||
c.body = [200, c.request.cookies]
|
||||
c.body = c.request.cookies
|
||||
})
|
||||
}))
|
||||
|
||||
@ -52,7 +51,7 @@ The Parser also defines a getter and setter for cookies
|
||||
###### Example
|
||||
```javascript
|
||||
// Set a cookie
|
||||
c.request.cookie.set({
|
||||
ctx.request.cookie.set({
|
||||
key: 'my_id',
|
||||
value: '12345678',
|
||||
path: '/',
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cca-koa-cookie",
|
||||
"version": "0.1.2",
|
||||
"version": "0.1.3",
|
||||
"description": "Cookie Parser and Setter for Koa",
|
||||
"main": "Cookie.js",
|
||||
"repository": {
|
||||
@ -20,4 +20,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