T
tRPC

Can you chain middlewares in v10?

Can you chain middlewares in v10?

Jjaiv11/2/2022
Would I be able to make a rate limit and isAuthed middleware, then put queries behind both middlewares so it's rate limited and protected by auth? The docs suggest it doesn't work like this, but I wanted to make sure. i found the answer from this discussion ThumbsUp https://github.com/trpc/trpc/discussions/2770#discussioncomment-3728971 very cool
UUUnknown User11/6/2022
Message Not Public
Sign In & Join Server To View
Jjaiv11/11/2022
you still get access to a typed context in middlewares? its also not that bad, if you want middlewares shared by all procedures just add all of them to one procedure that you use by default, use a raw procedure if you need more customization. i use a ratelimited procedure by default and if i dont want it i use the normal one

Looking for more? Join the community!

T
tRPC

Can you chain middlewares in v10?

Join Server