From 876633141285a3920960b0276b22c3c3f221b5bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Fern=C3=A1ndez=20Noriega?= Date: Mon, 8 Apr 2024 08:39:59 +0200 Subject: [PATCH] Another fix for questio service score --- docker-compose.yml | 2 ++ questionservice/question-service.js | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 273579b..afc1319 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -48,12 +48,14 @@ services: build: ./questionservice depends_on: - mongodb + - userservice ports: - "8010:8010" networks: - mynetwork environment: MONGODB_URI: mongodb://mongodb:27017/userdb + USER_SERVICE_URL: http://userservice:8001 # platform: linux/arm64 gatewayservice: container_name: gatewayservice-${teamname:-defaultASW} diff --git a/questionservice/question-service.js b/questionservice/question-service.js index adc4b4e..512809c 100644 --- a/questionservice/question-service.js +++ b/questionservice/question-service.js @@ -8,7 +8,7 @@ const app = express(); const port = 8010; const axios = require('axios'); -const apiEndpoint = process.env.REACT_APP_API_ENDPOINT || 'http://localhost:8000'; +const userServiceUrl = process.env.USER_SERVICE_URL || 'http://localhost:8001'; app.use(express.static('public')); @@ -214,13 +214,13 @@ app.post('/imgs/answer', async (req, res) => { const obj = req.body; if (obj.question == answerToQuestionMap.get(obj.answer)) { - await axios.post(apiEndpoint + '/addpoints', + await axios.post(userServiceUrl + '/addpoints', { username: obj.username, category: obj.category, correct: "true" }); res.status(200).json({ correct: "true", }) } else { - await axios.post(apiEndpoint + '/addpoints', + await axios.post(userServiceUrl + '/addpoints', { username: obj.username, category: obj.category, correct: "false" }); res.status(200).json({