What is the difference between procedures and middlewares in TRPC?

Hello! I was wondering what is the difference between procedures and middleware in TRPC. I know that procedures are used to build context and such but could you not also essentially do what is done in a middleware inside the procedure itself? Thanks!
1 Reply
cje
cje14mo ago
yes, everything that middlewares can do can also be done in a procedure but middlewares allow you to make some common bits reusable for example create t3 app comes with a middleware that checks if the request is coming from a logged in user you wouldn't want to write that logic in every procedure
Want results from more Discord servers?
Add your server
More Posts