From 931f96cdce0f22288638b98cd0483d2f25c7ae5b Mon Sep 17 00:00:00 2001 From: Luke Nelson Date: Mon, 1 Jan 2024 22:05:43 +0000 Subject: [PATCH] docs: mention `readValidatedBody` and `getValidatedQuery` (#24990) --- docs/2.guide/2.directory-structure/1.server.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/2.guide/2.directory-structure/1.server.md b/docs/2.guide/2.directory-structure/1.server.md index dff7da17ff..2dac8d9f86 100644 --- a/docs/2.guide/2.directory-structure/1.server.md +++ b/docs/2.guide/2.directory-structure/1.server.md @@ -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.