mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
docs: update legacy server examples (#19797)
This commit is contained in:
parent
9e67e57efd
commit
65f40d0443
@ -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}
|
||||||
|
Loading…
Reference in New Issue
Block a user