From dd3ad08a0bb76ad08fb29367fa532bc5bc57d660 Mon Sep 17 00:00:00 2001 From: emergent-agent-e1 Date: Sat, 8 Nov 2025 17:05:10 +0000 Subject: [PATCH] auto-commit for 0a3cdff9-26d6-44e6-b6cd-25cf78be1d53 --- frontend/src/config/api.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 frontend/src/config/api.ts diff --git a/frontend/src/config/api.ts b/frontend/src/config/api.ts new file mode 100644 index 00000000..70fbcd08 --- /dev/null +++ b/frontend/src/config/api.ts @@ -0,0 +1,24 @@ +// API Configuration +// Single source of truth for backend URL + +const getBackendUrl = (): string => { + const url = process.env.EXPO_PUBLIC_BACKEND_URL; + + if (!url) { + console.error('⚠️ EXPO_PUBLIC_BACKEND_URL not set! Using fallback.'); + return 'http://localhost:8001'; + } + + console.log('✅ Backend URL:', url); + return url; +}; + +export const API_BASE_URL = getBackendUrl(); + +export const API_ENDPOINTS = { + AUTH_SIGNUP: `${API_BASE_URL}/api/auth/signup`, + AUTH_SIGNIN: `${API_BASE_URL}/api/auth/signin`, + AUTH_USER: (userId: string) => `${API_BASE_URL}/api/auth/user/${userId}`, + VERIFY_TURNSTILE: `${API_BASE_URL}/api/verify-turnstile`, + BALANCE: `${API_BASE_URL}/api/blockchain/balance`, +};