From 65f40d044371fd1fd599b25f301b982d944738fc Mon Sep 17 00:00:00 2001 From: Fahmi Elfituri Date: Sun, 19 Mar 2023 16:35:51 +0200 Subject: [PATCH] docs: update legacy server examples (#19797) --- docs/2.guide/2.directory-structure/1.server.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/2.guide/2.directory-structure/1.server.md b/docs/2.guide/2.directory-structure/1.server.md index d53346e237..36927a446f 100644 --- a/docs/2.guide/2.directory-structure/1.server.md +++ b/docs/2.guide/2.directory-structure/1.server.md @@ -266,9 +266,9 @@ export default defineEventHandler((event) => { ### Return a Legacy Handler or Middleware ```ts [server/api/legacy.ts] -export default (req, res) => { +export default fromNodeMiddleware((req, res) => { res.end('Legacy handler') -} +}) ``` ::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] -export default (req, res, next) => { +export default fromNodeMiddleware((req, res, next) => { console.log('Legacy middleware') next() -} +}) ``` ::alert{type=warning}