icflorescu / trpc-sveltekit

End-to-end typesafe APIs with tRPC.io for your SvelteKit applications.

Home Page:https://icflorescu.github.io/trpc-sveltekit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use this package with a separate backend

yourGuy opened this issue · comments

createTRPCClient only allows relative urls, so how can this package be used with a backend on a separate domain or port ?

According to #52 (comment), it's not the use case meant for this library. You should just use the tRPC vanilla client.
https://trpc.io/docs/vanilla

As @Sazzo says, if your back-end is on a separate domain/port, a should probably be using the tRPC vanilla client.
tRPC-SvelteKit is suited for monolithic SvelteKit apps.

As @Sazzo says, if your back-end is on a separate domain/port, a should probably be using the tRPC vanilla client. tRPC-SvelteKit is suited for monolithic SvelteKit apps.

I need it to work in both scenarios, one scenario is as a sveltekit app (monolithic) and therefore the url is local, and the other scenario is when it's running not at theserver.com, lets say it will run as an app through "webview", so i would like to point the URL to the sveltekit monolithic app.

and that way, both ways are covered.