Natnael B. Haile
Cursor
feat: complete IR Studio with Git LFS tracking for all binary assets and NFCorpus index
fbad523 Download src/api/config.ts from NathyB/ir-studio: direct link, hf CLI and curl.
- Browser
- Download file 874 Bytes
-
https://huggingface.co/spaces/NathyB/ir-studio/resolve/main/src/api/config.ts
- Command line
-
hf download hf://spaces/NathyB/ir-studio/src/api/config.ts
-
curl -L -o config.ts https://huggingface.co/spaces/NathyB/ir-studio/resolve/main/src/api/config.ts
874 Bytes
| /** | |
| * API configuration for ir-studio. | |
| * Supports configurable VITE_API_URL for production deployments where frontend | |
| * and backend are hosted on separate domains or subpaths. | |
| */ | |
| // If VITE_API_URL is provided (e.g. "https://api.ir-studio.org" or "http://backend:8000"), | |
| // use it without trailing slash. Otherwise default to "" for same-origin relative URLs. | |
| const rawApiUrl = (import.meta.env.VITE_API_URL as string | undefined)?.trim() || ''; | |
| export const API_BASE_URL = rawApiUrl.replace(/\/+$/, ''); | |
| /** | |
| * Returns a fully qualified or relative URL for a given API endpoint. | |
| * | |
| * Example: | |
| * apiUrl('/api/health') => "/api/health" (default) or "https://api.my-domain.com/api/health" | |
| */ | |
| export function apiUrl(endpoint: string): string { | |
| const cleanEndpoint = endpoint.startsWith('/') ? endpoint : `/${endpoint}`; | |
| return `${API_BASE_URL}${cleanEndpoint}`; | |
| } | |