Define Router
info
- A procedure can be viewed as the equivalent of a REST-endpoint.
- There's no internal difference between queries and mutations apart from semantics.
- Defining router is the same for queries, mutations, and subscription with the exception that subscriptions need to return a Subscription-instance.
Input validation
tRPC works out-of-the-box with yup/superstruct/zod/myzod/custom validators/[..] - see test suite
Example without input
tsx
tsx
With Zod
tsx
tsx
With Yup
tsx
tsx
With Superstruct
tsx
tsx
Method chaining
To add multiple endpoints, you must chain the calls
tsx
tsx