Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
6cc3b67
Merge branch 'development' of https://github.com/ruiqi7/peer-prep int…
ruiqi7 Sep 28, 2024
be00118
Merge branch 'development' of https://github.com/ruiqi7/peer-prep int…
ruiqi7 Sep 28, 2024
efe97fb
Add testing for user service
guanquann Oct 1, 2024
d70696a
Fix lint
guanquann Oct 1, 2024
f31320b
Update .github
guanquann Oct 1, 2024
463d8f7
test ci
guanquann Oct 1, 2024
0e9f2c3
test ci
guanquann Oct 1, 2024
23a7c75
test ci
guanquann Oct 1, 2024
67de2c5
test ci
guanquann Oct 1, 2024
84bee13
test ci
guanquann Oct 1, 2024
7369ea3
test ci
guanquann Oct 1, 2024
eec093e
test ci
guanquann Oct 1, 2024
c2588df
test ci
guanquann Oct 1, 2024
39f91b8
Test ci
nicolelim02 Oct 1, 2024
905c3dd
test ci
guanquann Oct 1, 2024
7e4f8ce
Test ci
nicolelim02 Oct 1, 2024
1ec3f5d
test ci
guanquann Oct 1, 2024
b920b57
test ci
guanquann Oct 1, 2024
9ad075a
Test ci
nicolelim02 Oct 1, 2024
1b6aa85
Test ci
nicolelim02 Oct 1, 2024
dd63de1
test ci
guanquann Oct 1, 2024
20b6b99
test ci
guanquann Oct 1, 2024
0240980
Test ci
nicolelim02 Oct 1, 2024
c371e41
test ci
guanquann Oct 1, 2024
421d740
test ci
guanquann Oct 1, 2024
f1a99c0
Test ci
nicolelim02 Oct 1, 2024
c011c39
test ci
guanquann Oct 1, 2024
b28c409
Test ci
nicolelim02 Oct 1, 2024
1ec253e
test ci
guanquann Oct 1, 2024
349ac62
Test ci
nicolelim02 Oct 1, 2024
fb968a2
test ci
guanquann Oct 1, 2024
21f7589
test ci
guanquann Oct 1, 2024
706ef1e
Merge pull request #37 from nicolelim02/chore/tests
nicolelim02 Oct 1, 2024
4db9f1b
Test ci
nicolelim02 Oct 1, 2024
01c67b8
Merge pull request #38 from nicolelim02/chore/tests
nicolelim02 Oct 1, 2024
a3a75fc
Update ci
nicolelim02 Oct 1, 2024
fe04757
Merge pull request #39 from nicolelim02/chore/tests
guanquann Oct 1, 2024
0f5c1c1
test ci
guanquann Oct 1, 2024
a0f7ba8
Merge pull request #36 from guanquann/user-testing
guanquann Oct 1, 2024
bbdf05c
test ci
guanquann Oct 1, 2024
8bb8502
Merge pull request #40 from guanquann/user-testing
guanquann Oct 1, 2024
4aa397a
Add dockerfile for user service and docker compose
ruiqi7 Oct 1, 2024
236e03a
Merge branch 'development' of https://github.com/ruiqi7/peer-prep int…
ruiqi7 Oct 1, 2024
3614ed9
Merge pull request #41 from ruiqi7/deployment/docker
feliciagan Oct 1, 2024
be2c58d
Containerise question service
feliciagan Oct 1, 2024
8d32bd3
Merge branch 'development' into qnservice_docker
feliciagan Oct 1, 2024
1a96968
Update docker compose to include question service
feliciagan Oct 1, 2024
8b8ae50
Merge pull request #42 from feliciagan/qnservice_docker
ruiqi7 Oct 1, 2024
250475e
Fix user service dockerfile
ruiqi7 Oct 1, 2024
f095c08
Merge pull request #43 from ruiqi7/deployment/docker
feliciagan Oct 1, 2024
26b6c78
Add service dependency and restart policy in docker compose
ruiqi7 Oct 1, 2024
a24d33d
Merge pull request #44 from ruiqi7/deployment/docker
feliciagan Oct 1, 2024
1074be8
Refactor profile page
nicolelim02 Oct 1, 2024
a3de987
Fix issues
nicolelim02 Oct 2, 2024
2903a3c
Update props
nicolelim02 Oct 2, 2024
8bcdc80
Remove unused code
nicolelim02 Oct 2, 2024
db15fee
Refactor signup and login pages
nicolelim02 Oct 2, 2024
69a74da
Refactor edit profile modal
nicolelim02 Oct 2, 2024
f31d979
Refactor change password modal
nicolelim02 Oct 2, 2024
276d25a
Update password field
nicolelim02 Oct 2, 2024
d40d0dc
Add password tooltip
nicolelim02 Oct 2, 2024
5b5491f
Update password field in change password modal
nicolelim02 Oct 2, 2024
80d1b69
Update spacing between form inputs
nicolelim02 Oct 2, 2024
b67b657
Adjust text input size
nicolelim02 Oct 3, 2024
446c304
Merge branch 'development' into chore/refactor
nicolelim02 Oct 3, 2024
98ab0fa
Merge pull request #45 from nicolelim02/chore/refactor
ruiqi7 Oct 3, 2024
1d4d29c
Add read questions and categories tests
feliciagan Oct 3, 2024
88508b5
attribute readmes to peerprep userservice repo
feliciagan Oct 3, 2024
db281be
Merge pull request #46 from feliciagan/qn_service_test
nicolelim02 Oct 3, 2024
fda334a
Merge branch 'development' of https://github.com/ruiqi7/peer-prep int…
ruiqi7 Oct 3, 2024
e24c294
Debug edit profile
feliciagan Oct 3, 2024
19ed9a0
Implement dynamic tooltip for password field
ruiqi7 Oct 3, 2024
771237b
Fix confirm password error message
ruiqi7 Oct 3, 2024
163191e
Merge pull request #47 from feliciagan/edit_profile
ruiqi7 Oct 3, 2024
9e477eb
Merge branch 'development' of https://github.com/ruiqi7/peer-prep int…
ruiqi7 Oct 3, 2024
05c177d
Add required error message for sign up password field
ruiqi7 Oct 3, 2024
24b06c1
Keep tooltip open if password field is in focus
ruiqi7 Oct 4, 2024
7a60038
Merge pull request #48 from ruiqi7/feature/user-authentication
feliciagan Oct 4, 2024
519295c
Containerise frontend and update docker-compose
jolynloh Oct 4, 2024
8f6c5d9
Restore backend question controller
jolynloh Oct 4, 2024
ef3c043
Uncomment find match form
jolynloh Oct 4, 2024
5dff1cc
Modify landing logic and routes
jolynloh Oct 5, 2024
c601878
Add landing page and modify navbar
jolynloh Oct 5, 2024
2f01347
Add mongodb to docker, update readme
guanquann Oct 5, 2024
48bfd05
Fix env
guanquann Oct 5, 2024
273e2ff
Add seed for qns
guanquann Oct 5, 2024
68941fb
Update readme
guanquann Oct 5, 2024
63b3805
Add instructions to seed qns
guanquann Oct 5, 2024
996d12f
Write tests for create and update questions
jolynloh Oct 5, 2024
1f134ac
add edit profile picture
feliciagan Oct 5, 2024
5adfc36
Merge pull request #49 from jolynloh/FE/containerise
guanquann Oct 6, 2024
1c31446
Merge branch 'development' of https://github.com/guanquann/cs3219-ay2…
guanquann Oct 6, 2024
fcfc613
Fix test
guanquann Oct 6, 2024
fe5134e
Use cross-env instead of export for windows compatibility
guanquann Oct 6, 2024
cb33897
update navbar avatar when edit profile
feliciagan Oct 6, 2024
cbaf0ad
Merge pull request #50 from guanquann/mongodb-docker
ruiqi7 Oct 6, 2024
e25a97f
resolve merge conflicts
feliciagan Oct 6, 2024
5e80ee0
resolve comment issue
feliciagan Oct 6, 2024
4fd4834
Merge pull request #52 from feliciagan/profilepic
jolynloh Oct 6, 2024
57b1da9
Update readme
ruiqi7 Oct 6, 2024
b5f084a
Shift firebase set up to backend directory readme
ruiqi7 Oct 6, 2024
6e3ea64
Fix merge conflict
jolynloh Oct 6, 2024
62575ad
Remove indicators
jolynloh Oct 6, 2024
f236fa9
Merge pull request #51 from jolynloh/qa/d2-test
ruiqi7 Oct 6, 2024
3a9e8c0
Merge pull request #53 from ruiqi7/docs/readme
nicolelim02 Oct 6, 2024
f791787
Fix linting issues
nicolelim02 Oct 6, 2024
e1b04e1
Exclude matching form
nicolelim02 Oct 6, 2024
641f6bb
Merge pull request #54 from nicolelim02/feat/users
nicolelim02 Oct 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ on:
push:
branches:
- "*"
pull_request:
branches:
- "*"

env:
NODE_VERSION: 20
FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
FIREBASE_PRIVATE_KEY: ${{ secrets.FIREBASE_PRIVATE_KEY }}
FIREBASE_CLIENT_EMAIL: ${{ secrets.FIREBASE_CLIENT_EMAIL }}
FIREBASE_STORAGE_BUCKET: ${{ secrets.FIREBASE_STORAGE_BUCKET }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}

permissions:
contents: read

jobs:
ci:
Expand All @@ -30,6 +35,16 @@ jobs:
- name: Linting
working-directory: ${{ matrix.service }}
run: npm run lint
# - name: Tests
# working-directory: ${{ matrix.service }}
# run: npm test
- name: Set .env variables
working-directory: ${{ matrix.service }}
run: |
touch .env
echo "FIREBASE_PROJECT_ID=${{ env.FIREBASE_PROJECT_ID }}" >> .env
echo "FIREBASE_PRIVATE_KEY=${{ env.FIREBASE_PRIVATE_KEY }}" >> .env
echo "FIREBASE_CLIENT_EMAIL=${{ env.FIREBASE_CLIENT_EMAIL }}" >> .env
echo "FIREBASE_CLIENT_EMAIL=${{ env.FIREBASE_CLIENT_EMAIL }}" >> .env
echo "FIREBASE_STORAGE_BUCKET=${{ env.FIREBASE_STORAGE_BUCKET }}" >> .env
echo "JWT_SECRET=${{ env.JWT_SECRET }}" >> .env
- name: Tests
working-directory: ${{ matrix.service }}
run: npm test
7 changes: 7 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cd ./frontend && npm run lint && npm run test
cd ..

cd ./backend/user-service && npm run lint && npm run test
cd ../..

cd ./backend/question-service && npm run lint && npm run test
34 changes: 27 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
[![Review Assignment Due Date](https://classroom.github.com/assets/deadline-readme-button-22041afd0340ce965d47ae6ef1cefeee28c7c493a6346c4f15d667ab976d596c.svg)](https://classroom.github.com/a/bzPrOe11)
# CS3219 Project (PeerPrep) - AY2425S1 Group 28

# CS3219 Project (PeerPrep) - AY2425S1
## Setting up

## Group: G28
We will be using Docker to set up PeerPrep. Install Docker [here](https://docs.docker.com/get-started/get-docker).

### Note:
Follow the instructions in [here](./backend/README.md) first before proceeding.

- You can choose to develop individual microservices within separate folders within this repository **OR** use individual repositories (all public) for each microservice.
- In the latter scenario, you should enable sub-modules on this GitHub classroom repository to manage the development/deployment **AND** add your mentor to the individual repositories as a collaborator.
- The teaching team should be given access to the repositories as we may require viewing the history of the repository in case of any disputes or disagreements.
1. Build all the services (without using cache).

```
docker-compose build --no-cache
```

2. Run all the services (in detached mode).

```
docker-compose up -d
```

To stop all the services, use the following command:

```
docker-compose down
```

## Useful links

- User Service: http://localhost:3001
- Question Service: http://localhost:3000
- Frontend: http://localhost:5173
16 changes: 16 additions & 0 deletions backend/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Credentials for MongoDB and Mongo Express.
# Create a copy of this file and name it `.env`. Change the values accordingly.

# MongoDB credentials
MONGO_INITDB_ROOT_USERNAME=root
MONGO_INITDB_ROOT_PASSWORD=example

# Mongo Express credentials
ME_CONFIG_BASICAUTH_USERNAME=admin
ME_CONFIG_BASICAUTH_PASSWORD=password

# Do not change anything below this line
ME_CONFIG_MONGODB_ADMINUSERNAME=${MONGO_INITDB_ROOT_USERNAME}
ME_CONFIG_MONGODB_ADMINPASSWORD=${MONGO_INITDB_ROOT_PASSWORD}

ME_CONFIG_MONGODB_URL=mongodb://${MONGO_INITDB_ROOT_USERNAME}:${MONGO_INITDB_ROOT_PASSWORD}@mongo:27017/
126 changes: 126 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# PeerPrep Backend

> Before proceeding to each microservice for more instructions:

1. Set-up either a local or cloud MongoDB.

2. Set-up Firebase.

## Setting-up local MongoDB (only if you are using Docker)

1. In the `backend` directory, create a copy of the `.env.sample` file and name it `.env`.

2. To set up credentials for the MongoDB database, update `MONGO_INITDB_ROOT_USERNAME`, `MONGO_INITDB_ROOT_PASSWORD` of the `.env` file.

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.

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.

## Setting-up cloud MongoDB (in production)

> 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)

1. Visit the MongoDB Atlas Site [https://www.mongodb.com/atlas](https://www.mongodb.com/atlas) and click on "Try Free".

2. Sign Up/Sign In with your preferred method.

3. You will be greeted with welcome screens. Feel free to skip them till you reach the Dashboard page.

4. Create a Database Deployment by clicking on the green `+ Create` Button:

![alt text](./GuideAssets/Creation.png)

5. Make selections as followings:

- Select Shared Cluster
- Select `aws` as Provider

![alt text](./GuideAssets/Selection1.png)

- Select `Singapore` for Region

![alt text](./GuideAssets/Selection2.png)

- Select `M0 Sandbox` Cluster (Free Forever - No Card Required)

> Ensure to select M0 Sandbox, else you may be prompted to enter card details and may be charged!

![alt text](./GuideAssets/Selection3.png)

- Leave `Additional Settings` as it is

- Provide a suitable name to the Cluster

![alt text](./GuideAssets/Selection4.png)

![alt text](./GuideAssets/Security.png)

7. Next, click on `Add my Current IP Address`. This will whitelist your IP address and allow you to connect to the MongoDB Database.

![alt text](./GuideAssets/Network.png)

8. Click `Finish and Close` and the MongoDB Instance should be up and running.

9. [Optional] Whitelisting All IP's

1. Select `Network Access` from the left side pane on Dashboard.

![alt text](./GuideAssets/SidePane.png)

2. Click on the `Add IP Address` Button

![alt text](./GuideAssets/AddIPAddress.png)

3. Select the `ALLOW ACCESS FROM ANYWHERE` Button and Click `Confirm`

![alt text](./GuideAssets/IPWhitelisting.png)

4. Now, any IP Address can access this Database.

10. After setting up, go to the Database Deployment Page. You would see a list of the Databases you have set up. Select `Connect` on the cluster you just created earlier.

![alt text](GuideAssets/ConnectCluster.png)

11. Select the `Drivers` option.

![alt text](GuideAssets/DriverSelection.png)

12. Select `Node.js` in the `Driver` pull-down menu, and copy the connection string.

Notice, you may see `<password>` in this connection string. We will be replacing this with the admin account password that we created earlier on when setting up the Shared Cluster.

![alt text](GuideAssets/ConnectionString.png)

13. Your cloud Mongo URI will be the string you copied earlier. Take note of it as we will be using in the `.env` files in the various microservices later on.

## Setting-up Firebase

1. Go to https://console.firebase.google.com/u/0/.

2. Create a project and choose a project name. Navigate to `Storage` and click on it to activate it.

3. Select `Start in production mode` and your preferred cloud storage region.

4. After Storage is created, go to `Rules` section and set rule to:

```
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read: if true;
allow write: if request.auth != null;
}
}
}
```

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.

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.

6. You will need to update the following variables in the `.env` files of the various microservices later on.
- `FIREBASE_PROJECT_ID` is the value of `project_id` found in the downloaded json file.
- `FIREBASE_PRIVATE_KEY` is the value of `private_key` found in the downloaded json file.
- `FIREBASE_CLIENT_EMAIL` is the value of `client_email` found in the downloaded json file.
- `FIREBASE_STORAGE_BUCKET` is the folder path of the Storage. It should look something like `gs://<appname>.appspot.com`.
5 changes: 5 additions & 0 deletions backend/question-service/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage
node_modules
tests
.env*
*.md
15 changes: 9 additions & 6 deletions backend/question-service/.env.sample
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
MONGO_URI=MONGO_URI
NODE_ENV=development

FIREBASE_PROJECT_ID=FIREBASE_PROJECT_ID
FIREBASE_PRIVATE_KEY=FIREBASE_PRIVATE_KEY
FIREBASE_CLIENT_EMAIL=FIREBASE_CLIENT_EMAIL
FIREBASE_STORAGE_BUCKET=FIREBASE_STORAGE_BUCKET
MONGO_CLOUD_URI=<MONGO_CLOUD_URI>
MONGO_LOCAL_URI=<MONGO_LOCAL_URI>

FIREBASE_PROJECT_ID=<FIREBASE_PROJECT_ID>
FIREBASE_PRIVATE_KEY=<FIREBASE_PRIVATE_KEY>
FIREBASE_CLIENT_EMAIL=<FIREBASE_CLIENT_EMAIL>
FIREBASE_STORAGE_BUCKET=>FIREBASE_STORAGE_BUCKET>

ORIGINS=http://localhost:5173,http://127.0.0.1:5173

USER_SERVICE_URL=USER_SERVICE_URL
USER_SERVICE_URL=http://user-service:3001/api
13 changes: 13 additions & 0 deletions backend/question-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:20-alpine

WORKDIR /question-service

COPY package*.json ./

RUN npm ci

COPY . .

EXPOSE 3000

CMD ["npm", "start"]
72 changes: 20 additions & 52 deletions backend/question-service/README.md
Original file line number Diff line number Diff line change
@@ -1,71 +1,39 @@
# Question Service

## Setting-up MongoDB
> If you have not set-up either a local or cloud MongoDB, as well as Firebase, visit [this](../README.md) before proceeding.

> :notebook: If you are familiar to MongoDB and wish to use a local instance, please feel free to do so. This guide utilizes MongoDB Cloud Services.
## Setting-up Question Service

1. Set up a MongoDB Shared Cluster by following the steps in this [Guide](../user-service/MongoDBSetup.md).
1. In the `question-service` directory, create a copy of the `.env.sample` file and name it `.env`.

2. After setting up, go to the Database Deployment Page. You would see a list of the Databases you have set up. Select `Connect` on the cluster you just created earlier.
2. To connect to your cloud MongoDB instead of your local MongoDB, set the `NODE_ENV` to `production` instead of `development`.

![alt text](../user-service/GuideAssets/ConnectCluster.png)
3. Update `MONGO_CLOUD_URI`, `MONGO_LOCAL_URI`, `FIREBASE_PROJECT_ID`, `FIREBASE_PRIVATE_KEY`, `FIREBASE_CLIENT_EMAIL`, `FIREBASE_STORAGE_BUCKET`.

3. Select the `Drivers` option, as we have to link to a Node.js App (Question Service).
## Running Question Service without Docker

![alt text](../user-service/GuideAssets/DriverSelection.png)

4. Select `Node.js` in the `Driver` pull-down menu, and copy the connection string.

Notice, you may see `<password>` in this connection string. We will be replacing this with the admin account password that we created earlier on when setting up the Shared Cluster.

![alt text](../user-service/GuideAssets/ConnectionString.png)

5. In the `question-service` directory, create a copy of the `.env.sample` file and name it `.env`.

6. Update the `MONGO_URI` of the `.env` file, and paste the string we copied earlier in step 4.

## Setting-up Firebase

1. Go to https://console.firebase.google.com/u/0/.

2. Create a project and choose a project name. Navigate to `Storage` and click on it to activate it.

3. Select `Start in production mode` and your preferred cloud storage region.
1. Follow the instructions [here](https://nodejs.org/en/download/package-manager) to set up Node v20.

4. After Storage is created, go to `Rules` section and set rule to:
2. Open Command Line/Terminal and navigate into the `question-service` directory.

```
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read: if true;
allow write: if request.auth != null;
}
}
}
```
3. Run the command: `npm install`. This will install all the necessary dependencies.

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.
4. 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.

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.
## Seeding questions into MongoDB

6. In `.env` of question service, replace:
- `FIREBASE_PROJECT_ID` with `project_id` found in the downloaded json file.
- `FIREBASE_PRIVATE_KEY` with `private_key` found in the downloaded json file.
- `FIREBASE_CLIENT_EMAIL` with `client_email` found in the downloaded json file.
- `FIREBASE_STORAGE_BUCKET` with the folder path of the Storage. It should look something like `gs://<appname>.appspot.com`.
1. With Docker

## Running Question Service
- Run `docker ps` to get a list of the Docker containers on your machine.
- Retrieve the `CONTAINER_ID` of `peerprep/question-service`.
- Run `docker exec -it <CONTAINER_ID> npm run seed`.

1. Follow the instructions [here](https://nodejs.org/en/download/package-manager) to set up Node v20.
2. Without Docker

2. Open Command Line/Terminal and navigate into the `question-service` directory.

3. Run the command: `npm install`. This will install all the necessary dependencies.
- Run `npm run seed`.

4. 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.
## After running

5. To view Question Service documentation, go to http://localhost:3000/docs.
1. To view Question Service documentation, go to http://localhost:3000/docs.

6. 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.
2. 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.
5 changes: 0 additions & 5 deletions backend/question-service/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import yaml from "yaml";
import fs from "fs";
import cors from "cors";

import connectDB from "./config/db.ts";
import questionRoutes from "./src/routes/questionRoutes.ts";

dotenv.config();
Expand All @@ -19,10 +18,6 @@ const swaggerDocument = yaml.parse(file);

const app = express();

if (process.env.NODE_ENV !== "test") {
connectDB();
}

app.use(cors({ origin: allowedOrigins, credentials: true }));
app.options("*", cors({ origin: allowedOrigins, credentials: true }));

Expand Down
Loading