Skip to content

Commit

Permalink
docs: add table to assignment 1
Browse files Browse the repository at this point in the history
  • Loading branch information
sltsheryl committed Nov 17, 2023
1 parent 1b2ff36 commit 8f50dff
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 69 deletions.
15 changes: 7 additions & 8 deletions Assignment1.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

## To setup and execute

1. Download the zip file named `ay2324s1-course-assessment-g17-Assignment-1-updated.zip` from [Assignment-1-updated](https://github.com/CS3219-AY2324S1/ay2324s1-course-assessment-g17/releases/tag/Assignment-1-updated).
2. Unzip the file and navigate to the folder `ay2324s1-course-assessment-g17-Assignment-1-updated`.
3. Set up the environment variables in `.env` for `backend/question-service` and `frontend`.
4. `cd` into `backend/question-service` and `frontend`. Run `npm install` to install the dependencies for `question-service` and `frontend`.

Note: You may need to run `npm i --save-dev @types/cors` and `npm i --save-dev @types/express` should you encounter any errors.

5. In `frontend` and `backend/question-service`, run `npm start`.
| **Step** | **Description** |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1 | Download the zip file named `ay2324s1-course-assessment-g17-Assignment-1-updated.zip` from [Assignment-1-updated](https://github.com/CS3219-AY2324S1/ay2324s1-course-assessment-g17/releases/tag/Assignment-1-updated). |
| 2 | Unzip the file and navigate to the folder `ay2324s1-course-assessment-g17-Assignment-1-updated`. |
| 3 | Set up the environment variables in `.env` for `backend/question-service` and `frontend`. |
| 4 | `cd` into `backend/question-service` and `frontend`. Run `npm install` to install the dependencies for `question-service` and `frontend`. Note: You may need to run `npm i --save-dev @types/cors` and `npm i --save-dev @types/express` should you encounter any errors. |
| 5 | In `frontend` and `backend/question-service`, run `npm start`. Access the frontend by navigating to `localhost:3000` in your browser. |
26 changes: 14 additions & 12 deletions Assignment5.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# Assignment 5: Queue for Matching

## To set up and execute
| **Step** | **Description** |
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1 | Download the zip file named `ay2324s1-course-assessment-Assignment-5.zip` from [Assignment-5](https://github.com/CS3219-AY2324S1/ay2324s1-course-assessment-g17/releases/tag/Assignment-5). |
| 2 | Unzip the file and navigate to the folder `ay2324s1-course-assessment-Assignment-5`. |
| 3 | Set up the environment variables in `.env` for each of the microservices and `frontend`. |
| 4 | Run `npm install` to install the dependencies for each microservice and `frontend`. Note: You may need to run `npm i --save-dev @types/cors` and `npm i --save-dev @types/express` should you encounter any errors. |
| 5 | Run `brew install rabbitmq` to install RabbitMQ. |
| 6 | Run `rabbitmq-plugins enable rabbitmq_management` to enable the RabbitMQ management plugin. |
| 7 | Run `brew services start rabbitmq` to start the RabbitMQ server. |
| 8 | To ensure that the RabbitMQ server is running, navigate to `http://localhost:15672/` and login with the default credentials `guest` and `guest`. Note: If RabbitMQ is already running, you may want to run `brew services restart rabbitmq` instead. |
| 9 | Run `npm start` and navigate to `http://localhost:3000/` to access the frontend. |
| 10 | Once a successful match is made, you can verify the queue is working by navigating to `http://localhost:15672/#/queues`. You should see the queue `match_results` if it is successful. |

| **Step** | **Description** |
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1 | Download the zip file named `ay2324s1-course-assessment-Assignment-5.zip` from [Assignment-5](https://github.com/CS3219-AY2324S1/ay2324s1-course-assessment-g17/releases/tag/Assignment-5). |
| 2 | Unzip the file and navigate to the folder `ay2324s1-course-assessment-Assignment-5`. |
| 3 | Set up the environment variables in `.env` for each of the microservices and `frontend`. |
| 4 | Run `npm install` to install the dependencies for each microservice and `frontend`. Note: You may need to run `npm i --save-dev @types/cors` and `npm i --save-dev @types/express` should you encounter any errors. |
| 5 | Run `brew install rabbitmq` to install RabbitMQ. |
| 6 | Run `rabbitmq-plugins enable rabbitmq_management` to enable the RabbitMQ management plugin. |
| 7 | Run `brew services start rabbitmq` to start the RabbitMQ server. |
| 8 | To ensure that the RabbitMQ server is running, navigate to `http://localhost:15672/` and login with the default credentials `guest` and `guest`. Note: If RabbitMQ is already running, you may want to run `brew services restart rabbitmq` instead. |
| 9 | Run `npm start` and navigate to `http://localhost:3000/` to access the frontend. |
| 10 | Once a successful match is made, you can verify the queue is working by navigating to `http://localhost:15672/#/queues`. You should see the queue `match_results` if it is successful. |
82 changes: 38 additions & 44 deletions backend/collaboration-service/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,50 +71,44 @@ httpServer.listen(SOCKET_IO_PORT, () => {
});

// Code Execution
app.get(
"/api/code-execute/:token",
async (req: Request, res: Response) => {
try {
const token = req.params.token;
const url = `https://${process.env.REACT_APP_RAPID_API_HOST}/submissions/${token}`;
const response = await axios.get(url, {
params: { base64_encoded: 'true', fields: '*' },
headers: {
'X-RapidAPI-Host': process.env.REACT_APP_RAPID_API_HOST,
'X-RapidAPI-Key': process.env.REACT_APP_RAPID_API_KEY,
},
});
res.send(response.data);
} catch (err) {
res.json({
errors: [{ msg: "Something went wrong." }],
});
}
},
);
app.post(
"/api/code-execute",
async (req: Request, res: Response) => {
try {
const url = `https://${process.env.REACT_APP_RAPID_API_HOST}/submissions`;
const response = await axios.post(url, req.body, {
params: { base64_encoded: 'true', fields: '*' },
headers: {
'content-type': 'application/json',
'Content-Type': 'application/json',
'X-RapidAPI-Host': process.env.REACT_APP_RAPID_API_HOST,
'X-RapidAPI-Key': process.env.REACT_APP_RAPID_API_KEY,
},
});
const token = response.data.token as string;
res.send(token);
} catch (err) {
res.json({
errors: [{ msg: "Something went wrong." }],
});
}
},
);
app.get("/api/code-execute/:token", async (req: Request, res: Response) => {
try {
const token = req.params.token;
const url = `https://${process.env.REACT_APP_RAPID_API_HOST}/submissions/${token}`;
const response = await axios.get(url, {
params: { base64_encoded: "true", fields: "*" },
headers: {
"X-RapidAPI-Host": process.env.REACT_APP_RAPID_API_HOST,
"X-RapidAPI-Key": process.env.REACT_APP_RAPID_API_KEY,
},
});
res.send(response.data);
} catch (err) {
res.json({
errors: [{ msg: "Something went wrong." }],
});
}
});
app.post("/api/code-execute", async (req: Request, res: Response) => {
try {
const url = `https://${process.env.REACT_APP_RAPID_API_HOST}/submissions`;
const response = await axios.post(url, req.body, {
params: { base64_encoded: "true", fields: "*" },
headers: {
"content-type": "application/json",
"Content-Type": "application/json",
"X-RapidAPI-Host": process.env.REACT_APP_RAPID_API_HOST,
"X-RapidAPI-Key": process.env.REACT_APP_RAPID_API_KEY,
},
});
const token = response.data.token as string;
res.send(token);
} catch (err) {
res.json({
errors: [{ msg: "Something went wrong." }],
});
}
});

app.get("/api/check-authorization", checkAuthorisedUser);
app.get("/api/get-first-question", getFirstQuestion);
Expand Down
8 changes: 3 additions & 5 deletions backend/user-service/src/controllers/authController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -692,11 +692,9 @@ export const updateUserProfile: RequestHandler[] = [
});

if (!user) {
return res
.status(401)
.json({
message: "Had issues retrieving user while updating tokens",
});
return res.status(401).json({
message: "Had issues retrieving user while updating tokens",
});
}

//
Expand Down

0 comments on commit 8f50dff

Please sign in to comment.