Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Score for game and rankings #91

Merged
merged 9 commits into from
Apr 6, 2024
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
}
]
}
8 changes: 7 additions & 1 deletion gatewayservice/gateway-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,15 @@ app.get('/imgs/foods/question', async (req, res) => {
app.post('/imgs/answer', async (req, res) => {
try {
const answer = req.body.answer;
const username = req.body.username;
const category = req.body.category;
const question = req.body.question;

// Forward the request to the question service
const questionResponse = await axios.post(questionServiceUrl+'/imgs/answer', {answer:answer, question:question}, { headers: {'Content-Type': 'application/json'} });
const questionResponse = await axios.post(questionServiceUrl+'/imgs/answer',
{answer:answer, question: question, username: username, category: category },
{ headers: {'Content-Type': 'application/json'} });

res.json(questionResponse.data);
} catch (error) {
res.status(error.response.status).json({ error: error.response.data.error });
Expand Down
Loading
Loading