diff --git a/docs/tutorial/getting-started/validation/index.md b/docs/tutorial/getting-started/validation/index.md index 83d10d08..5e258b6d 100644 --- a/docs/tutorial/getting-started/validation/index.md +++ b/docs/tutorial/getting-started/validation/index.md @@ -127,16 +127,17 @@ 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')) - .listen(3000) + .post( + '/user', + ({ body: { name } }) => `Hello ${name}!`, + { + body: t.Object({ + name: t.String() + }) + } + ) ```