How to divide public and private routes?
I am creating and app that has a dashboard panel for admin, and public routes, for users. Let's say that i have a resource called, "products", admins can add products y users get the details, right now i have something like
"products.get", this works fine for the users consumers, but now i want to create and endpoint to get more details (that are not exposed to the users), but i can't use the same path "products.get". So i was looking for some ideas to handle this case, maybe create a router "private", and add all the protected resources there? and another one public?. this will give me something like
"private.products.get" and "public.products.get"... but idk, maybe there is abetter option
1 Reply
v9 or v10? it depends a bit
but see the docs here
https://trpc.io/docs/v9/authorization#option-2-authorize-using-middleware
https://trpc.io/docs/v10/authorization#option-2-authorize-using-middleware