docs: add sendRedirect usage (#19070)

This commit is contained in:
yuyin 2023-02-16 22:53:23 +08:00 committed by GitHub
parent 7aa35ff958
commit c8b49a3253
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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]