MCPcopy
hub / github.com/learnhouse/learnhouse / deriveAPIUrl

Function deriveAPIUrl

apps/web/services/config/config.ts:143–150  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

141
142// Derive API URL from backend URL (with backward compat for NEXT_PUBLIC_LEARNHOUSE_API_URL)
143const deriveAPIUrl = (): string => {
144 // Backward compat: if explicit API URL is set, use it
145 const explicitApiUrl = getConfig('NEXT_PUBLIC_LEARNHOUSE_API_URL')
146 if (explicitApiUrl) return explicitApiUrl
147 // Derive from backend URL
148 const backendUrl = getLEARNHOUSE_BACKEND_URL().replace(/\/+$/, '')
149 return `${backendUrl}/api/v1/`
150}
151
152// For direct usage, these call the getters
153export const getAPIUrl = () => {

Callers 2

getAPIUrlFunction · 0.85
getServerAPIUrlFunction · 0.85

Calls 3

getConfigFunction · 0.85
replaceMethod · 0.80

Tested by

no test coverage detected