T
tRPC

Get query parameters in middleware

Get query parameters in middleware

Bbret_pat8/4/2023
Hi! I'm looking to perform authorization inside of middleware and I'm wondering how I can access the parameters that the user queried inside of the middleware? For example, let's say a user requested to look at Workout routine ID 532 in an API call. How would I be able to access the workout ID inside of middleware? I have their userID within CTX but no way to get the url path Thanks!
Bbret_pat8/4/2023
It seems like middleware passes in input and rawInput as paramters but I don't think they're documented as what they do Any idea why "input" is undefined as a middleware parameter but "rawInput" is not?
Ttristanzajonc9/8/2023
It doesn't have a type yet. You need to parse it. See this example: https://trpc.io/docs/v9/middlewares#raw-input

Looking for more? Join the community!

T
tRPC

Get query parameters in middleware

Join Server