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: firestore/angular-rewrite/README.md
+61-2Lines changed: 61 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,7 @@
7
7
FriendlyEats is a restaurant recommendation app built on Firestore. It was built with the [Angular](https://angular.io/) Javascript framework, and can make use of [Firebase's Local Emulator Suite](emulator-docs) (specifically, the [Authentication](https://firebase.google.com/docs/emulator-suite/connect_auth), [Storage](https://firebase.google.com/docs/emulator-suite/connect_storage), [Functions](https://firebase.google.com/docs/emulator-suite/connect_functions), and [Firestore](https://firebase.google.com/docs/emulator-suite/connect_firestore) emulators) so that the quickstart can be run without needing to create a project in the [Firebase Console](https://console.firebase.google.com).
8
8
9
9
For more information about Firestore visit the [Firestore docs][firestore-docs].
10
+
10
11
For more information about the Firebase Emulator Suite visit the [Emulator Suite docs][emulator-docs]
@@ -17,7 +18,7 @@ Before following the steps to build and run this quickstart you will need:
17
18
1.[Node.Js](https://nodejs.org/en/download) Version 16.0 or higher
18
19
2.[Java](https://jdk.java.net/) JDK version 11 or higher.
19
20
20
-
## Setup and run the app locally:
21
+
## Configure and run the app locally with emulators:
21
22
22
23
Follow these steps to setup and run the quickstart:
23
24
@@ -36,14 +37,72 @@ Follow these steps to setup and run the quickstart:
36
37
npm install && (cd functions && npm install)
37
38
```
38
39
39
-
***Note:** When modifying the contents of `functions/src`, be sure to run `npm run build`in the `functions/` directory so that Typescript changes can be compiled bundled into the next emulator run.*
40
+
>**Note:** When modifying the contents of `functions/src`, be sure to run `npm run build`in the `functions/` directory so that Typescript changes can be compiled and present inthe next emulator run.
40
41
41
42
1. Run and serve the project locally:
42
43
```bash
43
44
npm start
44
45
```
45
46
1. Open [http://127.0.0.1:4200](http://127.0.0.1:4200) in your browser and try out the app!
47
+
48
+
## Configure and run the app with the Firebase Console:
49
+
50
+
Follow these steps to have a working version of the quickstart running with the Firebase console:
51
+
52
+
>**Note:** In the original application (that runs on the emulators), there is a Firebase Function that updates the `avgRating` field of a restaurant whenever that restaurant recieves a review. While **Authentication**, **Storage**, and **Firestore** are offered as free services through the Firebase console, using Firebase **Functions** on the Firebase Console requires a billing plan. There is a [free tier billing plan](https://firebase.google.com/pricing) that allows up to 2 million free functioncalls per month, but enabling this plan requires presenting payment information to Firebase. The following instructions, therefore, exclude those steps needed to deploy and host functions on the Firebase Console. All application functionality, other than the auto-updating `avgRating` field for restaurants, is conserved.
53
+
54
+
1. Create a new Firebase project in the [Firebase Console](https://console.firebase.google.com)
55
+
56
+
2. On the project homepage, select`Web` under `Get Started By Adding Firebase To Your App` and follow prompts to create your app, making sure to **copy the `firebaseConfig` object** when presented.
46
57
58
+

59
+
60
+

61
+
62
+
3. With the `firebaseConfig` copied, navigate to `src/environments/environments.ts` and paste the contents of the object into the `prod` field:
63
+
64
+

65
+
66
+
4. On line 79 of `src/app/app.module.ts`, change your environment from `environments.local` to `environments.prod`in the `provideFirebaseApp`functioncall
67
+
68
+

69
+
70
+
5. Back in the Firebase console, enable email and password authentication on your project by doing: **Authentication > SIGN-IN METHOD > Email > Email/Password > SAVE**
71
+
72
+

73
+
74
+
6. In the Firebase console, enable Firestore on your project by clicking **Create Database**in the **Cloud Firestore** section of the console and answering all prompts.
75
+
76
+
* When prompted, select"Startin Test Mode"
77
+
78
+

79
+
80
+
7. Simmilarly, enable Cloud Storage on your project by clicking **Get Started** in the **Storage** section of the console and answering all prompts.
81
+
82
+
* When prompted, select "Start in Test Mode"
83
+
84
+

85
+
86
+
8. Set the CLI to use the project you created in Step 1:
87
+
88
+
```bash
89
+
firebase --use add
90
+
```
91
+
92
+
9. Deploy the firebase security rules and indexes
93
+
94
+
```bash
95
+
firebase deploy --only firestore
96
+
```
97
+
98
+
> **Note:** If you've opted to set up a billing plan and wish to deploy functions as well, replace this command with simply `firebase deploy`.
99
+
100
+
10. Serve your Angular app and see it connect to the Firebase Console!
0 commit comments