docs: update nested router example (#10115)

This commit is contained in:
FenLiaoYu 2023-01-17 06:41:38 +08:00 committed by GitHub
parent f0c894060c
commit 8892cccb06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -201,14 +201,14 @@ export default defineNuxtConfig({
### Using a Nested Router
```ts [server/api/hello.ts]
import { createRouter } from 'h3'
```ts [server/api/hello/[...slug].ts]
import { createRouter, defineEventHandler, useBase } from 'h3'
const router = createRouter()
router.get('/', () => 'Hello World')
router.get('/test', defineEventHandler(() => 'Hello World'))
export default router
export default useBase('/api/hello', router.handler)
```
### Sending Streams (Experimental)