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