Skip to content

Commit

Permalink
feat: serveUniversal
Browse files Browse the repository at this point in the history
  • Loading branch information
alextekartik committed Jul 1, 2024
1 parent 439545f commit 2d86b1f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion functions_node/bin/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Future main() async {
firebaseFunctionsUniversal['thelloworldcorsv2'] = firebaseFunctionsUniversal
.https
.onRequestV2(HttpsOptions(region: regionBelgium, cors: true), helloWorld);
await firebaseFunctionsUniversal.serve();
await firebaseFunctionsUniversal.serveUniversal();
print('serving...');
}

Expand Down
5 changes: 4 additions & 1 deletion functions_node/lib/firebase_functions_universal_interop.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export 'package:tekartik_firebase_functions/firebase_functions.dart';

export 'src/ff_universal_common.dart'
show FirebaseFunctionsUniversal, FirebaseFunctionsServiceUniversal;
show
FirebaseFunctionsUniversal,
FirebaseFunctionsServiceUniversal,
FirebaseFunctionsUniversalExt;
export 'src/universal/ff_universal.dart';
8 changes: 7 additions & 1 deletion functions_node/lib/src/ff_universal_common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abstract class FirebaseFunctionsUniversal extends FirebaseFunctions {
FirebaseFunctionsUniversal() : super();

/// No effect on node
Future<FfServer?> serve({int? port});
Future<FfServer> serve({int? port});
}

abstract class FirebaseFunctionsUniversalBase extends FirebaseFunctionsHttpBase
Expand All @@ -50,3 +50,9 @@ class FirebaseFunctionsHttpUniversal extends FirebaseFunctionsUniversalBase
final FirebaseFunctionsUniversal firebaseFunctionsUniversalMemory =
FirebaseFunctionsHttpUniversal(
newFirebaseAppLocal(), httpServerFactoryMemory);

/// Extension to expose the serve method.
extension FirebaseFunctionsUniversalExt on FirebaseFunctions {
Future<FfServer> serveUniversal({int? port}) =>
(this as FirebaseFunctionsUniversal).serve(port: port);
}

0 comments on commit 2d86b1f

Please sign in to comment.