tRPCttRPC
Powered by
aryzingA
tRPC•3y ago•
3 replies
aryzing

Can middleware be used on a router?

Given a router where all procedures need to use the same middleware, can the middleware be somehow attached to the router instead of manually to routes?

For example, given an "admin" router, it would be quite catastrophic if one of the endpoints was accidentally set up with a
publicProcedure
publicProcedure
instead of
adminProcedure = publicProcedure.use(isAdmin)
adminProcedure = publicProcedure.use(isAdmin)
.
Solution
no, it’s not possible
Jump to solution
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Use middleware on the router level
bill92Bbill92 / ❓-help
11mo ago
Can trpc be used when both app and pages router is used at once ?
HussamHHussam / ❓-help
15mo ago