From 2499b57de322e00d247c764ba28fed51a18abf64 Mon Sep 17 00:00:00 2001 From: foofybuster Date: Sat, 11 Oct 2025 11:39:55 +0700 Subject: [PATCH 1/2] Hotfix: correct the answer of the Validation lesson --- .../getting-started/validation/index.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/tutorial/getting-started/validation/index.md b/docs/tutorial/getting-started/validation/index.md index 83d10d08..ec6b984a 100644 --- a/docs/tutorial/getting-started/validation/index.md +++ b/docs/tutorial/getting-started/validation/index.md @@ -127,15 +127,18 @@ Let's execrise what we have learned. We can define a schema by using `t.Object` provide to `body` property. ```typescript -import { Elysia } from 'elysia' +import { Elysia, t } from 'elysia' new Elysia() - .get('/', ({ status, set }) => { - set.headers['x-powered-by'] = 'Elysia' - - return status(418, 'Hello Elysia!') - }) - .get('/docs', ({ redirect }) => redirect('https://elysiajs.com')) + .post( + '/user', + ({ body: { name } }) => `Hello ${name}!`, + { + body: t.Object({ + name: t.String() + }) + } + ) .listen(3000) ``` From 0f6e6c3b94ecdf089a2718539ccaae7150f5f029 Mon Sep 17 00:00:00 2001 From: foofybuster Date: Sat, 11 Oct 2025 11:49:34 +0700 Subject: [PATCH 2/2] Hotfix: as the coderabbitai suggested --- .../getting-started/validation/index.md | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/docs/tutorial/getting-started/validation/index.md b/docs/tutorial/getting-started/validation/index.md index ec6b984a..5e258b6d 100644 --- a/docs/tutorial/getting-started/validation/index.md +++ b/docs/tutorial/getting-started/validation/index.md @@ -128,18 +128,16 @@ We can define a schema by using `t.Object` provide to `body` property. ```typescript import { Elysia, t } from 'elysia' - new Elysia() - .post( - '/user', - ({ body: { name } }) => `Hello ${name}!`, - { - body: t.Object({ - name: t.String() - }) - } - ) - .listen(3000) + .post( + '/user', + ({ body: { name } }) => `Hello ${name}!`, + { + body: t.Object({ + name: t.String() + }) + } + ) ```