TimKleierT
tRPC15mo ago
1 reply
TimKleier

Any guidance on adding middleware at the router level?

I want to apply middleware across all admin routes. I could add middleware to the adminProcedure, but I'd prefer to do so at the router level. I didn't see any info in the docs. How can I accomplish this?
const adminRouter = router({
  secretPlace: adminProcedure.query(() => 'a key'),
  secretPlace2: adminProcedure.query(() => 'b key')
});
Was this page helpful?