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: backend/README.md
+4-12Lines changed: 4 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,22 +2,12 @@
2
2
3
3
> Before proceeding to each microservice for more instructions:
4
4
5
-
1. Set-up either a local or cloud MongoDB.
5
+
1. Setup cloud MongoDB if not using docker. We recommend this if you are just testing out each microservice separately to avoid needing to manually set up multiple instances of local MongoDB. Else, if you are using docker-compose.yml to run PeerPrep, check out the READMEs in the different backend microservices to set up the env for the local MongoDB instances.
6
6
7
-
2. Set-up Firebase.
7
+
2. Setup Firebase.
8
8
9
9
3. Follow the instructions [here](https://nodejs.org/en/download/package-manager) to set up Node v20.
10
10
11
-
## Setting-up local MongoDB (only if you are using Docker)
12
-
13
-
1. In the `backend` directory, create a copy of the `.env.sample` file and name it `.env`.
14
-
15
-
2. To set up credentials for the MongoDB database, update `MONGO_INITDB_ROOT_USERNAME`, `MONGO_INITDB_ROOT_PASSWORD` of the `.env` file.
16
-
17
-
3. Your local Mongo URI will be `mongodb://<MONGO_INITDB_ROOT_USERNAME>:<MONGO_INITDB_ROOT_PASSWORD>@mongo:27017/`. Take note of it as we will be using in the `.env` files in the various microservices later on.
18
-
19
-
4. You can view the MongoDB collections locally using Mongo Express. To set up Mongo Express, update `ME_CONFIG_BASICAUTH_USERNAME` and `ME_CONFIG_BASICAUTH_PASSWORD`. The username and password will be the login credentials when you access Mongo Express at http://localhost:8081.
20
-
21
11
## Setting-up cloud MongoDB (in production)
22
12
23
13
> This guide references the [user-service README in the PeerPrep-UserService repository](https://github.com/CS3219-AY2425S1/PeerPrep-UserService/blob/main/user-service/README.md)
@@ -97,6 +87,8 @@
97
87
98
88
## Setting-up Firebase
99
89
90
+
> For ease of testing, you can set up just one firebase to use across all the microservices that need it.
91
+
100
92
1. Go to https://console.firebase.google.com/u/0/.
101
93
102
94
2. Create a project and choose a project name. Navigate to `Storage` and click on it to activate it.
3. Update `FIREBASE_PROJECT_ID`, `FIREBASE_PRIVATE_KEY`, `FIREBASE_CLIENT_EMAIL`, `FIREBASE_STORAGE_BUCKET`, `MONGO_CLOUD_URI` with the env variables obtained from following the instructions in the backend README. Then update `MONGO_INITDB_ROOT_USERNAME`, `MONGO_INITDB_ROOT_PASSWORD` to change your MongoDB credentials if necessary.
12
+
13
+
4. You can view the MongoDB collections locally using Mongo Express. To set up Mongo Express, update `ME_CONFIG_BASICAUTH_USERNAME` and `ME_CONFIG_BASICAUTH_PASSWORD`. The username and password will be the login credentials when you access Mongo Express at http://localhost:8081.
12
14
13
15
## Running Question Service without Docker
14
16
17
+
> Make sure you have the cloud MongoDB URI in your .env file and set NODE_ENV to production already.
18
+
15
19
1. Open Command Line/Terminal and navigate into the `question-service` directory.
16
20
17
21
2. Run the command: `npm install`. This will install all the necessary dependencies.
Copy file name to clipboardExpand all lines: backend/question-service/src/scripts/seed.ts
+12-26Lines changed: 12 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -11,98 +11,84 @@ export async function seedQuestions() {
11
11
description:
12
12
"Design an algorithm to serialize and deserialize a binary tree. There is no restriction on how your serialization/deserialization algorithm should work. You just need to ensure that a binary tree can be serialized to a string and this string can be deserialized to the original tree structure. \n\n",
13
13
complexity: "Hard",
14
-
category: ["Tree","Design"],
14
+
category: ["Tree"],
15
15
},
16
16
{
17
17
title: "Two Sum",
18
18
description:
19
19
"Given an array of integers `nums` and an integer `target`, return indices of the two numbers such that they add up to `target`. You may assume that each input would have **exactly one solution**, and you may not use the same element twice. You can return the answer in any order.",
20
20
complexity: "Easy",
21
-
category: ["Array","Hash Table"],
22
-
},
23
-
{
24
-
title: "Add Two Numbers",
25
-
description:
26
-
"You are given two non-empty linked lists representing two non-negative integers. The digits are stored in **reverse order**, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itself.",
27
-
complexity: "Medium",
28
-
category: ["Linked List","Math"],
21
+
category: ["Arrays"],
29
22
},
30
23
{
31
24
title: "Longest Substring Without Repeating Characters",
32
25
description:
33
26
"Given a string `s`, find the length of the **longest substring** without repeating characters.",
"Given two sorted arrays `nums1` and `nums2` of size `m` and `n` respectively, return the median of the two sorted arrays.",
41
34
complexity: "Hard",
42
-
category: ["Array","Binary Search","Divide and Conquer"],
35
+
category: ["Arrays"],
43
36
},
44
37
{
45
38
title: "Longest Palindromic Substring",
46
39
description:
47
40
"Given a string `s`, return the **longest palindromic substring** in `s`.",
48
41
complexity: "Medium",
49
-
category: ["String","Dynamic Programming"],
42
+
category: ["Strings","Dynamic Programming"],
50
43
},
51
44
{
52
45
title: "ZigZag Conversion",
53
46
description:
54
47
"The string `PAYPALISHIRING` is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: `PAHNAPLSIIGYIR` Write the code that will take a string and make this conversion given a number of rows.",
55
48
complexity: "Medium",
56
-
category: ["String"],
49
+
category: ["Strings"],
57
50
},
58
51
{
59
52
title: "Reverse Integer",
60
53
description:
61
54
"Given a signed 32-bit integer `x`, return `x` with its digits reversed. If reversing `x` causes the value to go outside the signed 32-bit integer range `[-2^31, 2^31 - 1]`, then return 0.",
62
55
complexity: "Easy",
63
-
category: ["Math"],
56
+
category: ["Strings"],
64
57
},
65
58
{
66
59
title: "String to Integer (atoi)",
67
60
description:
68
61
"Implement the `myAtoi(string s)` function, which converts a string to a 32-bit signed integer (similar to C/C++'s `atoi` function).",
69
62
complexity: "Medium",
70
-
category: ["Math","String"],
71
-
},
72
-
{
73
-
title: "Palindrome Number",
74
-
description:
75
-
"Given an integer `x`, return `true` if `x` is a palindrome integer. An integer is a palindrome when it reads the same backward as forward. For example, `121` is palindrome while `123` is not.",
76
-
complexity: "Easy",
77
-
category: ["Math"],
63
+
category: ["Strings"],
78
64
},
79
65
{
80
66
title: "Regular Expression Matching",
81
67
description:
82
68
"Given an input string `s` and a pattern `p`, implement regular expression matching with support for `'.'` and `'*'` where: - `'.'` Matches any single character. - `'*'` Matches zero or more of the preceding element.",
"Given `n` non-negative integers `a1, a2, ..., an`, where each represents a point at coordinate `(i, ai)`. `n` vertical lines are drawn such that the two endpoints of the line `i` is at `(i, ai)` and `(i, 0)`. Find two lines, which, together with the x-axis forms a container, such that the container contains the most water.",
90
76
complexity: "Medium",
91
-
category: ["Array","Two Pointers"],
77
+
category: ["Arrays"],
92
78
},
93
79
{
94
80
title: "Integer to Roman",
95
81
description:
96
82
"Roman numerals are represented by seven different symbols: `I`, `V`, `X`, `L`, `C`, `D` and `M`. Given an integer, convert it to a roman numeral.",
97
83
complexity: "Medium",
98
-
category: ["Math","String"],
84
+
category: ["Strings"],
99
85
},
100
86
{
101
87
title: "Roman to Integer",
102
88
description:
103
89
"Roman numerals are represented by seven different symbols: `I`, `V`, `X`, `L`, `C`, `D` and `M`. Given a roman numeral, convert it to an integer.",
0 commit comments