Replies: 6 comments 3 replies
-
First Try - Using the trpc
|
Beta Was this translation helpful? Give feedback.
-
Generally speaking, this seems to be the only issue left with the trpc integration: How to get the trpc routes into the main router?
Only the query call errors out, since the trpc client can't connect to the trpc server. |
Beta Was this translation helpful? Give feedback.
-
First locally working version - 1.0.0Try it
The LogicI built it like this
The DrawbacksStarting two servers (e.g. two Deno.listen() calls) in one script does not work in deno-deploy, bc. they only allow one call to Deno.listen(). I would also agree that having two separate servers is kind of clunky and should be avoided. Also a problem there: The |
Beta Was this translation helpful? Give feedback.
-
2.0.0 - Second locally working versionI found a second way to make trpc work in fresh. The Logic
Small ProblemIt's not running on deno-deploy yet due to hardcoded url in trpc client. |
Beta Was this translation helpful? Give feedback.
-
2.1.0 - First Version on Deno DeployI fixed the issue with the hardcoded url by using window.location.origin. CAUTION! This needs proper feature detection, bc. globalThis.location is NOT available in the deno deploy server environment! The Code:
|
Beta Was this translation helpful? Give feedback.
-
For anyone interested, I finished my blogpost about tRPC + fresh today: https://blog.codemonument.com/2022-11-03-trpc-in-fresh-islands |
Beta Was this translation helpful? Give feedback.
-
Hi there!
I was looking into building something with fresh and thought, that TRPC would be nice to handle some data fetching in my islands.
This thread should capture my research into integrating TRPC with fresh, since i realized, this is somewhat more complicated than i originally thought.
For reference, heres my initial issue for this: #864
And here is my repo for trying to integrate trpc v10 and fresh: https://github.com/jbscratch/trpc10-in-fresh
Beta Was this translation helpful? Give feedback.
All reactions