createNhostServiceEndpoint function

String createNhostServiceEndpoint({
  1. required String subdomain,
  2. required String region,
  3. required String service,
  4. String apiVersion = 'v1',
  5. String protocol = 'https',
})

Generate Endpoint for each service and based on the subdomain

Implementation

String createNhostServiceEndpoint({
  required String subdomain,
  required String region,
  required String service,
  String apiVersion = 'v1',
  String protocol = 'https',
}) {
  if (region.isEmpty && subdomain == 'local') {
    return '$protocol://$subdomain.$service.nhost.run/$apiVersion';
  }

  // production app, new subdomain approach
  return '$protocol://$subdomain.$service.$region.nhost.run/$apiVersion';
}