TRPC use api externally

Hi, i want to use my trpc api externally, as understand it because trpc uses superjson i cant just pass info to the backend doing something like in the screenshot. Would it be better to just have a regular api route not using trpc?
9 Replies
Neto
Neto•2y ago
trpc is just a typesafe way of calling a function on the backend but yes, you can call it externally if you call a trpc procedure from the client, you can get the http url, payload and all that
Max
Max•2y ago
aaah yep that sounds like a plan 🙂
Neto
Neto•2y ago
you should just be careful with context if you are executing a procedure with a auth middleware per example
Max
Max•2y ago
yeah, because its coming from a chrome extension it handles all of that stuff for me, as if im authed normally
Neto
Neto•2y ago
im talking about as a regular api route the default trpc implementation of protected middleware relies on next auth
Max
Max•2y ago
wym regular api route?
Neto
Neto•2y ago
"Hi, i want to use my trpc api externally"
Max
Max•2y ago
yeah, its just the superjson formatting which im figuring out rlly, auth stuff happens magically with extensions 🙂
Neto
Neto•2y ago
gl
Want results from more Discord servers?
Add your server