Skip to content

Commit 9ef9ccc

Browse files
committed
chore: update docs
1 parent b28d3e0 commit 9ef9ccc

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.changeset/silent-pumas-glow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'nextjs-koa-api': patch
3+
---
4+
5+
update docs: explain `attachRouter` function usage

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ For more info check out [Koa Router docs](https://github.com/koajs/router/blob/m
115115

116116
### Attaching a custom router
117117

118-
There is a convenient method for attaching a custom router. Internally it sets the `prefix` path on the router,and calls `router.routes()` and `router.allowedMethods()`
118+
There is a convenient function for attaching a custom router. Internally it sets the `prefix` path on the router,and calls `router.routes()` and `router.allowedMethods()`
119119

120120
```ts
121-
import {Router, KoaApi} from 'nextjs-koa-api`
121+
import {Router, KoaApi,attachRouter} from 'nextjs-koa-api`
122122

123123
const api = new KoaApi()
124124
const router = new Router()
@@ -130,7 +130,7 @@ router.get('/',(ctx,next)=>{
130130
return next()
131131
})
132132

133-
api.attachRouter('/some/deep-path', router)
133+
attachRouter('/some/deep-path',api, router)
134134

135135
```
136136

0 commit comments

Comments
 (0)