Brainstorming how to convert REST api to tRPC
I have a use case where I have a url that looks similar to
/stores/:store/items/:items
and store could have many sub routes to it. is there any ideas on the best way to convert this into a tRPC route?Solution:Jump to solution
create a stores router with different procedures, items being one of them, and then pass :store and :item as fields on your input object, so something like:
```ts
// ...
.input(z.object({ storeId: z.string(), itemId: z.string() }))...
1 Reply
Solution
create a stores router with different procedures, items being one of them, and then pass :store and :item as fields on your input object, so something like:
let me know if you need more details!