We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4eeb247 commit b2fb46fCopy full SHA for b2fb46f
1 file changed
packages/web/src/lib/api.ts
@@ -1,4 +1,8 @@
1
import { edenTreaty } from "@elysiajs/eden";
2
import type { App } from "@packages/server";
3
4
-export const api = edenTreaty<App>(window.location.origin, {}).api;
+// In production, PUBLIC_API_URL should be set to the backend URL.
5
+// In development, falls back to window.location.origin and use Vite's proxy to forward API requests to the backend.
6
+const baseUrl = import.meta.env.PUBLIC_API_URL ?? window.location.origin;
7
+
8
+export const api = edenTreaty<App>(baseUrl, {}).api;
0 commit comments