Skip to content

Commit

Permalink
Merge pull request #94 from Arquisoft/Develop
Browse files Browse the repository at this point in the history
Communication problems solved between webapp and api gateway
  • Loading branch information
uo289097 authored Mar 9, 2024
2 parents 8fac53a + 752268c commit 98acd31
Show file tree
Hide file tree
Showing 2 changed files with 6 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 @@ -109,6 +109,8 @@ services:
- gatewayservice
ports:
- "3000:3000"
environment:
GATEWAY_SERVICE_URL: http://gatewayservice:8000
#volumes:
#- ./webapp:/app

Expand Down
7 changes: 4 additions & 3 deletions webapp/src/components/Game.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { PostGame } from './PostGame'
const N_QUESTIONS = 10
const MAX_TIME = 600;

const gatewayUrl=process.env.GATEWAY_SERVICE_URL||"http://localhost:8000"

const Question = ({ goTo, setGameFinished }) => {

const [question, setQuestion] = useState('');
Expand Down Expand Up @@ -43,9 +45,8 @@ const Question = ({ goTo, setGameFinished }) => {
const fetchQuestion = async () => {

try {
const response = await fetch('http://localhost:8000/api/questions/create', {
method: 'GET',
mode: 'cors',
const response = await fetch(`${gatewayUrl}/api/questions/create`, {
method: 'GET'
});
const data = await response.json();

Expand Down

0 comments on commit 98acd31

Please sign in to comment.