|
22 | 22 |
|
23 | 23 | 5. In the `question-service` directory, create a copy of the `.env.sample` file and name it `.env`.
|
24 | 24 |
|
25 |
| -6. Update the `MONGO_URI` of the `.env` file, and paste the string we copied earlier in step 4. |
| 25 | +6. Update the `MONGO_URI` of the `.env` file, and paste the string we copied earlier in step 4. |
26 | 26 |
|
27 | 27 | ## Setting-up Firebase
|
28 | 28 |
|
29 | 29 | 1. Go to https://console.firebase.google.com/u/0/.
|
30 | 30 |
|
31 | 31 | 2. Create a project and choose a project name. Navigate to `Storage` and click on it to activate it.
|
32 | 32 |
|
33 |
| -3. Select `Start in production mode` and your preferred cloud storage region. |
| 33 | +3. Select `Start in production mode` and your preferred cloud storage region. |
34 | 34 |
|
35 | 35 | 4. After Storage is created, go to `Rules` section and set rule to:
|
36 |
| - ``` |
37 |
| - rules_version = '2'; |
38 |
| - service firebase.storage { |
39 |
| - match /b/{bucket}/o { |
40 |
| - match /{allPaths=**} { |
41 |
| - allow read: if true; |
42 |
| - allow write: if request.auth != null; |
43 |
| - } |
44 |
| - } |
45 |
| - } |
46 |
| - ``` |
47 |
| - This rule ensures that only verified users can upload images while ensuring that URLs of images are public. Remember to click `Publish` to save changes. |
| 36 | + |
| 37 | + ``` |
| 38 | + rules_version = '2'; |
| 39 | + service firebase.storage { |
| 40 | + match /b/{bucket}/o { |
| 41 | + match /{allPaths=**} { |
| 42 | + allow read: if true; |
| 43 | + allow write: if request.auth != null; |
| 44 | + } |
| 45 | + } |
| 46 | + } |
| 47 | + ``` |
| 48 | + |
| 49 | + This rule ensures that only verified users can upload images while ensuring that URLs of images are public. Remember to click `Publish` to save changes. |
48 | 50 |
|
49 | 51 | 5. Go to `Settings`, `Project settings`, `Service accounts` and click `Generate new private key`. This will download a `.json` file, which will contain your credentials.
|
50 | 52 |
|
|
54 | 56 | - `FIREBASE_CLIENT_EMAIL` with `client_email` found in the downloaded json file.
|
55 | 57 | - `FIREBASE_STORAGE_BUCKET` with the folder path of the Storage. It should look something like `gs://<appname>.appspot.com`.
|
56 | 58 |
|
57 |
| -
|
58 | 59 | ## Running Question Service
|
59 | 60 |
|
60 | 61 | 1. Open Command Line/Terminal and navigate into the `question-service` directory.
|
|
63 | 64 |
|
64 | 65 | 3. Run the command `npm start` to start the Question Service in production mode, or use `npm run dev` for development mode, which includes features like automatic server restart when you make code changes.
|
65 | 66 |
|
66 |
| -4. To view Question Service documentation, go to http://localhost:3001/docs. |
| 67 | +4. To view Question Service documentation, go to http://localhost:3000/docs. |
67 | 68 |
|
68 | 69 | 5. Using applications like Postman, you can interact with the Question Service on port 3000. If you wish to change this, please update the `.env` file.
|
0 commit comments