diff --git a/packages/nhost_flutter_auth/example/lib/config.dart b/packages/nhost_flutter_auth/example/lib/config.dart index 13117bc1..3a97c576 100644 --- a/packages/nhost_flutter_auth/example/lib/config.dart +++ b/packages/nhost_flutter_auth/example/lib/config.dart @@ -1,3 +1,3 @@ /// https://github.com/nhost/nhost-dart/#running-the-example-server -const subdomain = 'localhost'; +const subdomain = 'local'; const region = ''; diff --git a/packages/nhost_flutter_graphql/example/lib/config.dart b/packages/nhost_flutter_graphql/example/lib/config.dart index 13117bc1..3a97c576 100644 --- a/packages/nhost_flutter_graphql/example/lib/config.dart +++ b/packages/nhost_flutter_graphql/example/lib/config.dart @@ -1,3 +1,3 @@ /// https://github.com/nhost/nhost-dart/#running-the-example-server -const subdomain = 'localhost'; +const subdomain = 'local'; const region = ''; diff --git a/packages/nhost_functions_dart/example/lib/config.dart b/packages/nhost_functions_dart/example/lib/config.dart index 29080764..254777dd 100644 --- a/packages/nhost_functions_dart/example/lib/config.dart +++ b/packages/nhost_functions_dart/example/lib/config.dart @@ -1,4 +1,4 @@ /// https://github.com/nhost/nhost-dart/#running-the-example-server -const subdomain = 'localhost:1337'; +const subdomain = 'local'; const region = ''; -const functionsUrl = 'https://localhost:1337/v1/functions'; +const functionsUrl = 'https://local.functions.nhost.run'; diff --git a/packages/nhost_graphql_adapter/example/lib/config.dart b/packages/nhost_graphql_adapter/example/lib/config.dart index 13117bc1..3a97c576 100644 --- a/packages/nhost_graphql_adapter/example/lib/config.dart +++ b/packages/nhost_graphql_adapter/example/lib/config.dart @@ -1,3 +1,3 @@ /// https://github.com/nhost/nhost-dart/#running-the-example-server -const subdomain = 'localhost'; +const subdomain = 'local'; const region = ''; diff --git a/packages/nhost_sdk/lib/src/api/subdomain.dart b/packages/nhost_sdk/lib/src/api/subdomain.dart index 2b25f8b6..f0198857 100644 --- a/packages/nhost_sdk/lib/src/api/subdomain.dart +++ b/packages/nhost_sdk/lib/src/api/subdomain.dart @@ -13,19 +13,19 @@ class Subdomain { /// Project subdomain (e.g. `ieingiwnginwnfnegqwvdqwdwq`) /// /// Check out nhost dashboard and get your `subdomain` - /// for local development pass 'localhost' or 'localhost:1337' + /// for localhost development pass 'local' final String subdomain; /// Project region (e.g. `eu-central-1`) /// /// Check out nhost dashboard and get your `region` /// Project region is not required during - /// local development (when `subdomain` is `localhost`) - /// in case of localhost, you pass only empty string '' + /// local development (when `subdomain` is `local`) + /// in case of local, you pass only empty string '' final String region; /// When set, the admin secret is sent as a header, `x-hasura-admin-secret`, /// - /// for all requests to GraphQL, Storage, and Serverless Functions. + /// for all requests to GraphQL, Storage, and Functions. // final String? adminSecret; } diff --git a/packages/nhost_sdk/lib/src/foundation/uri.dart b/packages/nhost_sdk/lib/src/foundation/uri.dart index b7e1ca94..c2bf2ae6 100644 --- a/packages/nhost_sdk/lib/src/foundation/uri.dart +++ b/packages/nhost_sdk/lib/src/foundation/uri.dart @@ -13,28 +13,14 @@ String joinSubpath(String basePath, String subPath) { return '$path$suffix'; } -/// Generate Endpoint for each service and based on new subdomain approach or -/// override it to localhost for development based on old path-feature +/// Generate Endpoint for each service and based on the subdomain String createNhostServiceEndpoint({ - required String subdomain, // local + required String subdomain, required String region, required String service, String apiVersion = 'v1', String protocol = 'https', }) { - final localhostRegex = RegExp( - r'^((?http[s]?):\/\/)?(?localhost)(:(?(\d+|__\w+__)))?$', - ); - - // checking for local development environment - if (localhostRegex.hasMatch(subdomain)) { - final hasPort = subdomain.split(':').length == 2; - if (hasPort) { - return 'http://$subdomain/$apiVersion/$service'; - } - return 'http://$subdomain:1337/$apiVersion/$service'; - } - if (region.isEmpty && subdomain == 'local') { return '$protocol://$subdomain.$service.nhost.run/$apiVersion'; } diff --git a/packages/nhost_storage_dart/example/lib/config.dart b/packages/nhost_storage_dart/example/lib/config.dart index be06093d..3c5a95f4 100644 --- a/packages/nhost_storage_dart/example/lib/config.dart +++ b/packages/nhost_storage_dart/example/lib/config.dart @@ -1,10 +1,10 @@ import 'package:nhost_auth_dart/nhost_auth_dart.dart'; /// https://github.com/nhost/nhost-dart/#running-the-example-server -const subdomain = 'localhost:1337'; +const subdomain = 'local'; const region = ''; -const authUrl = 'https://localhost:1337/v1/auth'; -const storageUrl = 'https://localhost:1337/v1/storage'; +const authUrl = 'https://local.auth.nhost.run'; +const storageUrl = 'https://local.storage.nhost.run'; Future signInOrSignUp( NhostAuthClient nhostAuthClient, {