mirror of
https://github.com/cupcakearmy/koa-router.git
synced 2024-12-22 16:16:29 +00:00
Docs fixes
This commit is contained in:
parent
5638465101
commit
0eb643f5da
18
README.md
18
README.md
@ -9,12 +9,12 @@ const
|
|||||||
|
|
||||||
const
|
const
|
||||||
app = new Koa(),
|
app = new Koa(),
|
||||||
port = 3001
|
port = 3000
|
||||||
|
|
||||||
app.use(router(_ => {
|
app.use(router(_ => {
|
||||||
_.get('/user/:user/', (c, n) => {
|
_.get('/user/:user', (c, n) => {
|
||||||
c.body = c.request.param['user']
|
c.body = c.request.params['user']
|
||||||
// GET /user/foo/ => 'foo'
|
// GET /user/foo => 'foo'
|
||||||
})
|
})
|
||||||
}))
|
}))
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ app.listen(port)
|
|||||||
// 1
|
// 1
|
||||||
app.use(router(_ => {
|
app.use(router(_ => {
|
||||||
_.get('/mypath', (c, n) => {
|
_.get('/mypath', (c, n) => {
|
||||||
// GET /mypath
|
// GET /mypath
|
||||||
c.body = 'Some Response'
|
c.body = 'Some Response'
|
||||||
})
|
})
|
||||||
}))
|
}))
|
||||||
@ -64,18 +64,18 @@ app.use(router(_ => {
|
|||||||
// 2
|
// 2
|
||||||
app.use(router('/myprefix', _ => {
|
app.use(router('/myprefix', _ => {
|
||||||
_.get('/mypath', (c, n) => {
|
_.get('/mypath', (c, n) => {
|
||||||
// GET /myprefix/mypath
|
// GET /myprefix/mypath
|
||||||
c.body = 'Some Response'
|
c.body = 'Some Response'
|
||||||
})
|
})
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// 3
|
// 3
|
||||||
app.use(router({
|
app.use(router({
|
||||||
prefix: '/myprefix',
|
prefix: '/myprefix',
|
||||||
case: true
|
case: true
|
||||||
}, _ => {
|
}, _ => {
|
||||||
_.get('/myPath', (c, n) => {
|
_.get('/myPath', (c, n) => {
|
||||||
// GET /myprefix/myPath
|
// GET /myprefix/myPath
|
||||||
c.body = 'Some Response'
|
c.body = 'Some Response'
|
||||||
})
|
})
|
||||||
}))
|
}))
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cca-koa-router",
|
"name": "cca-koa-router",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"description": "Koa Router",
|
"description": "Koa Router",
|
||||||
"main": "Router.js",
|
"main": "Router.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
Loading…
Reference in New Issue
Block a user