mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
docs: mention readValidatedBody
and getValidatedQuery
(#24990)
This commit is contained in:
parent
219d1cd219
commit
931f96cdce
@ -230,6 +230,10 @@ export default defineEventHandler(async (event) => {
|
||||
})
|
||||
```
|
||||
|
||||
::callout{icon="i-ph-lightbulb" color="green" to="https://unjs.io/blog/2023-08-15-h3-towards-the-edge-of-the-web#runtime-type-safe-request-utils"}
|
||||
Alternatively, use `readValidatedBody` with a schema validator such as Zod for runtime and type safety.
|
||||
::
|
||||
|
||||
You can now universally call this API using:
|
||||
|
||||
```vue [app.vue]
|
||||
@ -259,6 +263,10 @@ export default defineEventHandler((event) => {
|
||||
})
|
||||
```
|
||||
|
||||
::callout{icon="i-ph-lightbulb" color="green" to="https://unjs.io/blog/2023-08-15-h3-towards-the-edge-of-the-web#runtime-type-safe-request-utils"}
|
||||
Alternatively, use `getValidatedQuery` with a schema validator such as Zod for runtime and type safety.
|
||||
::
|
||||
|
||||
### Error Handling
|
||||
|
||||
If no errors are thrown, a status code of `200 OK` will be returned.
|
||||
|
Loading…
Reference in New Issue
Block a user