mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 07:05:11 +00:00
docs: fix types in 'server utilities' example (#22978)
This commit is contained in:
parent
cdf9b5547e
commit
3c1d027977
@ -111,10 +111,12 @@ For example, you can define a custom handler utility that wraps the original han
|
||||
**Example:**
|
||||
|
||||
```ts [server/utils/handler.ts]
|
||||
import type { EventHandler } from 'h3'
|
||||
import type { EventHandler, EventHandlerRequest } from 'h3'
|
||||
|
||||
export const defineWrappedResponseHandler = (handler: EventHandler) =>
|
||||
defineEventHandler(async (event) => {
|
||||
export const defineWrappedResponseHandler = <T extends EventHandlerRequest, D> (
|
||||
handler: EventHandler<T, D>
|
||||
): EventHandler<T, D> =>
|
||||
defineEventHandler<T>(async event => {
|
||||
try {
|
||||
// do something before the route handler
|
||||
const response = await handler(event)
|
||||
|
Loading…
Reference in New Issue
Block a user