Update Readme

This commit is contained in:
nicco 2017-08-18 18:46:22 +02:00
parent 039b7fb6d0
commit 57f260c1bb
2 changed files with 9 additions and 12 deletions

View File

@ -5,20 +5,20 @@ Koa Cookie Utility
```javascript ```javascript
const const
Koa = require('koa'), Koa = require('koa'),
router = require('koa-simple-router'), router = require('koa-simple-router'),
cookie = require('cca-koa-cookie') cookie = require('cca-koa-cookie')
const const
app = new Koa(), app = new Koa(),
port = 3000 port = 3000
// Parse Parameters // Parse Parameters
app.use(require(cookie)) app.use(cookie)
app.use(router({}, _ => { app.use(router({}, _ => {
_.get('/set', (c, n) => { _.get('/set', (c, n) => {
// Set a cookie // Set a cookie
c.request.cookie.set({ c.request.cookie.set({
key: 'my_id', key: 'my_id',
value: '12345678', value: '12345678',
@ -27,7 +27,7 @@ app.use(router({}, _ => {
httpOnly: true, httpOnly: true,
secure: false secure: false
}) })
c.body = [200, 'Cookie Set'] c.body = [200, 'Cookie Set']
}) })

View File

@ -3,9 +3,6 @@
"version": "0.1.0", "version": "0.1.0",
"description": "Cookie Parser and Setter for Koa", "description": "Cookie Parser and Setter for Koa",
"main": "Cookie.js", "main": "Cookie.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/CupCakeArmy/koa-cookie.git" "url": "git+https://github.com/CupCakeArmy/koa-cookie.git"
@ -21,4 +18,4 @@
"url": "https://github.com/CupCakeArmy/koa-cookie/issues" "url": "https://github.com/CupCakeArmy/koa-cookie/issues"
}, },
"homepage": "https://github.com/CupCakeArmy/koa-cookie#readme" "homepage": "https://github.com/CupCakeArmy/koa-cookie#readme"
} }