docs: update legacy server examples (#19797)

This commit is contained in:
Fahmi Elfituri 2023-03-19 16:35:51 +02:00 committed by GitHub
parent 9e67e57efd
commit 65f40d0443
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -266,9 +266,9 @@ export default defineEventHandler((event) => {
### Return a Legacy Handler or Middleware ### Return a Legacy Handler or Middleware
```ts [server/api/legacy.ts] ```ts [server/api/legacy.ts]
export default (req, res) => { export default fromNodeMiddleware((req, res) => {
res.end('Legacy handler') res.end('Legacy handler')
} })
``` ```
::alert{type=warning} ::alert{type=warning}
@ -276,10 +276,10 @@ Legacy support is possible using [unjs/h3](https://github.com/unjs/h3), but it i
:: ::
```ts [server/middleware/legacy.ts] ```ts [server/middleware/legacy.ts]
export default (req, res, next) => { export default fromNodeMiddleware((req, res, next) => {
console.log('Legacy middleware') console.log('Legacy middleware')
next() next()
} })
``` ```
::alert{type=warning} ::alert{type=warning}