// Accept either a host-only URL or one that already ends with `/api`. // The HTTP client appends `/api` itself, so we normalize here to avoid // accidental `/api/api/...` requests from env values. const rawApiBaseUrl = (import.meta.env.VITE_API_URL as string | undefined) ?? "http://localhost:3001"; export const API_BASE_URL = rawApiBaseUrl .trim() .replace(/\/+$/, "") .replace(/\/api$/, "");