GitHub Action
Automated sync to Hugging Face
bb63c6c
Raw History Blame Contribute Delete
717 Bytes
/**
* Central API base URL.
*
* Production (Docker / Hugging Face Space): the built React app is served by
* the FastAPI backend from the SAME origin (port 7860), so a relative `/api`
* is correct — no host/port is hardcoded, which was previously breaking the
* Space (it defaulted to `http://localhost:8000/api`, i.e. the *user's* machine).
*
* Local development: Vite proxies `/api` → `http://localhost:8000` (see
* vite.config.ts), so `/api` also works under `npm run dev`.
*
* Set VITE_API_BASE_URL at build time to point at a different backend if you
* ever host the frontend separately from the API.
*/
export const API_BASE = (import.meta.env.VITE_API_BASE_URL || '/api').replace(/\/+$/, '');