Skip to content

Commit

Permalink
Another fix for questio service score
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianFN2 committed Apr 8, 2024
1 parent 2a5ebec commit 8766331
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
6 changes: 3 additions & 3 deletions questionservice/question-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down Expand Up @@ -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({
Expand Down

0 comments on commit 8766331

Please sign in to comment.