mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +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:**
|
**Example:**
|
||||||
|
|
||||||
```ts [server/utils/handler.ts]
|
```ts [server/utils/handler.ts]
|
||||||
import type { EventHandler } from 'h3'
|
import type { EventHandler, EventHandlerRequest } from 'h3'
|
||||||
|
|
||||||
export const defineWrappedResponseHandler = (handler: EventHandler) =>
|
export const defineWrappedResponseHandler = <T extends EventHandlerRequest, D> (
|
||||||
defineEventHandler(async (event) => {
|
handler: EventHandler<T, D>
|
||||||
|
): EventHandler<T, D> =>
|
||||||
|
defineEventHandler<T>(async event => {
|
||||||
try {
|
try {
|
||||||
// do something before the route handler
|
// do something before the route handler
|
||||||
const response = await handler(event)
|
const response = await handler(event)
|
||||||
|
Loading…
Reference in New Issue
Block a user