Skip to content

Commit

Permalink
Merge pull request #70 from Arquisoft/jota
Browse files Browse the repository at this point in the history
Cambios gateway
  • Loading branch information
uo276026 authored Mar 18, 2024
2 parents 7672b12 + a64e994 commit ee517a7
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 ee517a7

Please sign in to comment.