mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 07:40:33 +00:00
docs: use defineEventHandler()
to avoid warnings (#18557)
Avoid the warning: > [h3] Implicit event handler conversion is deprecated. Use `eventHandler()` or `fromNodeMiddleware()` to define event handlers.
This commit is contained in:
parent
5c7715813d
commit
64b835c707
@ -83,10 +83,10 @@ In brief, `useFetch` receives a URL and gets that data, whereas `useAsyncData` m
|
|||||||
|
|
||||||
```ts [server/api/count.ts]
|
```ts [server/api/count.ts]
|
||||||
let counter = 0
|
let counter = 0
|
||||||
export default () => {
|
export default defineEventHandler(() => {
|
||||||
counter++
|
counter++
|
||||||
return JSON.stringify(counter)
|
return JSON.stringify(counter)
|
||||||
}
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
```vue [app.vue]
|
```vue [app.vue]
|
||||||
|
Loading…
Reference in New Issue
Block a user