Skip to content

Commit

Permalink
Arreglado gatewayservice e reincorporación de userservice
Browse files Browse the repository at this point in the history
* Eliminación de Firebase de Webapp.
* Incorporación de questionservice en gateway.
* Actualizado el proceso por el que se crea la pregunta utilizando el gateway.
  • Loading branch information
UO277938 committed Mar 14, 2024
1 parent 72263c0 commit a64e994
Show file tree
Hide file tree
Showing 9 changed files with 1,452 additions and 1,470 deletions.
10 changes: 10 additions & 0 deletions gatewayservice/gateway-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 questionServiceUrl = process.env.QUESTION_SERVICE_URL || 'http://localhost:8003';

app.use(cors());
app.use(express.json());
Expand Down Expand Up @@ -41,6 +42,15 @@ app.post('/adduser', async (req, res) => {
}
});

app.get('/pregunta', async (req, res) => {
try{
const questionResponse = await axios.get(questionServiceUrl+'/pregunta')
res.json(questionResponse.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}`);
Expand Down
Loading

0 comments on commit a64e994

Please sign in to comment.