From 5d8d49c3451ec588ade3f097356f1c1d4585e2d9 Mon Sep 17 00:00:00 2001 From: Robert Soriano Date: Wed, 18 May 2022 00:03:54 -0700 Subject: [PATCH] update readme --- README.md | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 5959366..0b15d71 100644 --- a/README.md +++ b/README.md @@ -75,12 +75,12 @@ console.log(farewell); // => 👈 goodbye ## Recipes -### Input validation +### Input validation with [Zod](https://github.com/colinhacks/zod) -With [Zod](https://github.com/colinhacks/zod) +tRPC works out-of-the-box with yup/superstruct/zod/myzod/custom validators. Learn more about input validation [here](https://trpc.io/docs/router#input-validation). ```ts -// ~/trpc/index.ts +// ~/server/trpc/index.ts import { z } from 'zod' export const router = trpc @@ -99,28 +99,6 @@ export const router = trpc }) ``` -With [Yup](https://github.com/jquense/yup) - -```ts -// ~/trpc/index.ts -import { z } from 'zod' - -export const router = trpc - .router() - .mutation('createUser', { - // validate input with Zod - input: yup.object({ - name: yup.string().required(), - }), - async resolve(req) { - // use your ORM of choice - return await UserModel.create({ - data: req.input, - }) - }, - }) -``` - Learn more about tRPC.io [here](https://trpc.io/docs). ## License