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
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
aaah yep that sounds like a plan 🙂
you should just be careful with context
if you are executing a procedure with a auth middleware per example
yeah, because its coming from a chrome extension it handles all of that stuff for me, as if im authed normally
im talking about as a regular api route
the default trpc implementation of protected middleware relies on next auth
wym regular api route?
"Hi, i want to use my trpc api externally"
yeah, its just the superjson formatting which im figuring out rlly, auth stuff happens magically with extensions 🙂
gl