From c8b49a3253b9c5cf5b0118101acf685c69a10c96 Mon Sep 17 00:00:00 2001 From: yuyin <38490578+yuyinws@users.noreply.github.com> Date: Thu, 16 Feb 2023 22:53:23 +0800 Subject: [PATCH] docs: add `sendRedirect` usage (#19070) --- docs/2.guide/2.directory-structure/1.server.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/2.guide/2.directory-structure/1.server.md b/docs/2.guide/2.directory-structure/1.server.md index 451eb0363d..133c200351 100644 --- a/docs/2.guide/2.directory-structure/1.server.md +++ b/docs/2.guide/2.directory-structure/1.server.md @@ -255,6 +255,14 @@ export default defineEventHandler((event) => { }) ``` +### Sending Redirect + +```ts [server/api/foo.get.ts] +export default defineEventHandler((event) => { + return sendRedirect(event, '/path/redirect/to', 302) +}) +``` + ### Return a Legacy Handler or Middleware ```ts [server/api/legacy.ts]