File size: 717 Bytes
bb63c6c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/**
 * 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(/\/+$/, '');