You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.
I find them quite fiddly to write - counting brackets etc.
Suggestion A) Pipes
Standalone route
// single resolverconstmyProcedure=trpc.resolver(trpc.zod(z.object({id: z.string})),({ ctx, input })=>{return'my data goes here'})```### In a router```tsexportconstappRouter=trpc.router({queries: {// procedure with input validation called `greeting`greeting: trpc.resolver(trpc.zod(z.object({hello: z.string(),}),),(params)=>{return{data: {greeting: 'hello '+params.ctx.user?.id??params.input.hello,},};},),})
If you can show to me that two independent trpc.middleware()s can mutate the context in different ways without the second overriding the first, I might be with you on this
The Resolver API and middlewares
Problems with the current implementation
Suggestion A) Pipes
Standalone route
Inferring errors
Reusable middleware
Suggestion B) Closures & Chains
Standalone route
In a router
Reusable middleware
The text was updated successfully, but these errors were encountered: