elmeg-demo/frontend/lib/api-config.ts

8 lines
262 B
TypeScript

export function getApiUrl() {
if (typeof window === 'undefined') {
// Server-side
return process.env.INTERNAL_API_URL || 'http://localhost:8000'
}
// Client-side
return process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000'
}