From d8110dbf6ac02da50c09984de07850857292654b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Tru=C3=A9bano=20Robles?= Date: Thu, 14 Mar 2024 13:28:49 +0100 Subject: [PATCH] Deployment fixes --- gatewayservice/gateway-service.js | 10 ++++++++++ webapp/src/stores/playing-store.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gatewayservice/gateway-service.js b/gatewayservice/gateway-service.js index 88b84c8..c09eb16 100644 --- a/gatewayservice/gateway-service.js +++ b/gatewayservice/gateway-service.js @@ -8,6 +8,7 @@ const port = 8000; const authServiceUrl = process.env.AUTH_SERVICE_URL || 'http://localhost:8002'; const userServiceUrl = process.env.USER_SERVICE_URL || 'http://localhost:8001'; +const wikidataServiceUrl = process.env.WIKIDATA_SERVICE_URL || 'http://localhost:7259'; app.use(cors()); app.use(express.json()); @@ -41,6 +42,15 @@ app.post('/adduser', async (req, res) => { } }); +app.get('/WikiData/getCapitalQuestions', async (_req, res) => { + try { + const userResponse = await axios.get(wikidataServiceUrl+'/WikiData/getCapitalQuestions', req.body); + res.json(userResponse.data); + } catch (error) { + res.status(error.response.status).json({ error: error.response.data.error }); + } +}); + // Start the gateway service const server = app.listen(port, () => { console.log(`Gateway Service listening at http://localhost:${port}`); diff --git a/webapp/src/stores/playing-store.ts b/webapp/src/stores/playing-store.ts index b748e55..e0032b3 100644 --- a/webapp/src/stores/playing-store.ts +++ b/webapp/src/stores/playing-store.ts @@ -57,7 +57,7 @@ interface GameQuestions{ } const retrieveQuestions = () => { - return fetch('https://localhost:7259/WikiData/GetCapitalsQuestions') + return fetch('/WikiData/GetCapitalsQuestions') .then((response) => response.json()) .catch((error) => { console.error('There was a problem with the questions:', error);