File size: 322 Bytes
c5474d5
532554f
 
 
 
c5474d5
1
2
3
4
5
6
7
export function getApiUrl() {
  if (typeof window !== 'undefined') return ''; // browser should use relative url
  if (process.env['BACKEND_URL'])
    return `https://${process.env['BACKEND_URL']}`; // SSR should use vercel url
  return `http://localhost:${process.env['PORT'] ?? 3000}`; // dev SSR should use localhost
}