Need help how to send headers in trpc
project is setup with express on 2 parts,cleint and server
i have this pice of cod in client side here i send a small obj(email,password,confirm password) to create an user ,, this is my context and my middleware
7 Replies
here is my index When i use a route that has protectedProcedure how can i send with ?Like on client when i do a mutation/query i need to send smt or what ?
every idea is wellcome
Have you read the docs? https://trpc.io/docs/client/headers
Custom header | tRPC
The headers option can be customized in the config when using the httpBatchLink or the httpLink.
Yes sir @Nick Lucas
I really don’t understand
Any chance you have something else ?
Not sure how we can provide anything simpler than that example showing setting the auth header in a Link? You could copy and paste the whole thing and it would probably work for you
Even is setup for express ?
Cuz in doc if for next
And I use express
For next I understand how to use it
But not for express @Nick Lucas
It shouldn’t matter, that’s client setup and that’s the piece you’re missing. Express is the backend
Aha
I am really confused 😕
i will check how to set up in client