T3 Stack · Method
.use
The tRPC .use method attaches middleware to a procedure. Middleware can check context, reject a request, or pass a narrowed context to the next step.
Last updated
Syntax
t.procedure.use(({ ctx, next }) => next({ ctx }))In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
tRPCprotectedProcedureTRPCErrorcreateTRPCContextsessionmiddleware