Skip to content

Commit 30f20c4

Browse files
committed
use demo-example
1 parent 33edd23 commit 30f20c4

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

  • Dart/quickstarts/https-increment-number

Dart/quickstarts/https-increment-number/README.md

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@ It features two endpoints:
55
- `incrementLocal`: Simple POST request that takes a local count and returns it incremented by 1.
66
- `incrementSynced`: GET and POST endpoints that sync a counter variable to Firestore, returning the newly updated count.
77

8-
## Prerequisites
98

10-
1. Add your Firebase project to this Quickstart:
11-
```bash
12-
firebase use --add
13-
```
14-
2. Enable Firestore in the Firebase Console and configure the emulator for local testing.
159

1610
## Local Testing
1711

@@ -20,19 +14,17 @@ First, fetch dependencies:
2014
dart pub get
2115
```
2216

23-
Then, you can use the Firebase CLI to test the function:
17+
Then, you can use the Firebase CLI to test the function locally. To ensure both endpoints work properly, make sure to start both the functions and firestore emulators:
2418
```bash
25-
firebase emulators:start --only functions
19+
firebase emulators:start --project="demo-example" --only firestore,functions
2620
```
2721

28-
Note: To test `incrementSynced`, ensure you also start the Firestore emulator: `firebase emulators:start --only functions,firestore`.
29-
3022
### Testing `incrementLocal`
3123

3224
In a separate terminal, use cURL to POST to the function (replace the URL with the one provided by the emulator):
3325

3426
```bash
35-
curl -X POST http://127.0.0.1:5001/YOUR_PROJECT/us-central1/increment-local \
27+
curl -X POST http://127.0.0.1:5001/demo-example/us-central1/increment-local \
3628
-H "Content-Type: application/json" \
3729
-d '{"count": 5}'
3830
```
@@ -46,11 +38,11 @@ You should see:
4638

4739
To test using Firestore, fetch the initial count:
4840
```bash
49-
curl -X GET http://127.0.0.1:5001/YOUR_PROJECT/us-central1/increment-synced
41+
curl -X GET http://127.0.0.1:5001/demo-example/us-central1/increment-synced
5042
```
5143

5244
Then increment it using POST:
5345
```bash
54-
curl -X POST http://127.0.0.1:5001/YOUR_PROJECT/us-central1/increment-synced \
46+
curl -X POST http://127.0.0.1:5001/demo-example/us-central1/increment-synced \
5547
-H "Content-Type: application/json"
5648
```

0 commit comments

Comments
 (0)