You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-11Lines changed: 15 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,27 +47,31 @@ The CLI will also create a folder in your project called `celest`, which will in
47
47
```shell
48
48
flutter_app/
49
49
└── celest/
50
-
├── config/
51
-
│ └── .env # Environment variables
52
-
├── functions/ # Celest Functions folder
53
-
| └── greeting.dart # Example API file
50
+
├── functions/ # Celest Functions folder
51
+
| └── greeting.dart # Example API file
54
52
├── lib/
55
-
│ │── client.dart # Generated client for your Flutter app
56
-
│ ├── models.dart # Custom API models
57
-
│ └── exceptions.dart # Custom API exceptions
58
-
└── test/ # Tests for your backend
53
+
│ │── client.dart # Generated client for your Flutter app
54
+
│ ├── models/ # Custom API models
55
+
|| └── person.dart
56
+
│ └── exceptions/ # Custom API exceptions
57
+
| └── bad_name_exception.dart
58
+
└── test/ # Tests for your backend
59
59
```
60
60
61
61
To get started building your serverless cloud function, navigate to the `<flutter_app>/celest/functions/` folder and create a file named `<api_name>.dart`. You can create as many APIs as you want in this directory. Think of each file as a way to organize and group multiple Celest Functions of similar functionality into a namespace.
62
62
63
63
Celest Functions are defined as top-level functions as shown below.
64
64
65
65
```dart
66
-
Future<String> sayHello(String name) async {
66
+
Future<String> sayHello({
67
+
required String name,
68
+
}) async {
67
69
return 'Hello, $name';
68
70
}
69
71
70
-
Future<String> sayGoodbye(String name) async {
72
+
Future<String> sayGoodbye({
73
+
required String name,
74
+
}) async {
71
75
return 'Goodbye, $name';
72
76
}
73
77
```
@@ -98,7 +102,7 @@ class MyApp extends StatelessWidget {
0 commit comments