From b191adbaf7b2137d496f2183de7a11a1cb59e2d4 Mon Sep 17 00:00:00 2001 From: sergiollende Date: Thu, 14 Mar 2024 17:47:58 +0100 Subject: [PATCH] Another change on routes --- gatewayservice/gateway-service.js | 6 +++--- users/userservice/user-service.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gatewayservice/gateway-service.js b/gatewayservice/gateway-service.js index e74b13c..2a4bca8 100644 --- a/gatewayservice/gateway-service.js +++ b/gatewayservice/gateway-service.js @@ -25,7 +25,7 @@ app.get('/health', (_req, res) => { app.post('/login', async (req, res) => { try { // Forward the login request to the authentication service - const authResponse = await axios.post(authServiceUrl+'/login', req.body); + const authResponse = await axios.post(authServiceUrl + '/auth/login', req.body); res.json(authResponse.data); } catch (error) { res.status(error.response.status).json({ error: error.response.data.error }); @@ -35,7 +35,7 @@ app.post('/login', async (req, res) => { app.post('/adduser', async (req, res) => { try { // Forward the add user request to the user service - const userResponse = await axios.post(userServiceUrl+'/adduser', req.body); + const userResponse = await axios.post(userServiceUrl + '/user/adduser', req.body); res.json(userResponse.data); } catch (error) { res.status(error.response.status).json({ error: error.response.data.error }); @@ -45,7 +45,7 @@ app.post('/adduser', async (req, res) => { app.post('/edituser', async (req, res) => { try { // Forward the edit user request to the user service - const userResponse = await axios.post(userServiceUrl+'/edituser', req.body); + const userResponse = await axios.post(userServiceUrl + '/user/edituser', req.body); res.json(userResponse.data); } catch (error) { res.status(error.response.status).json({ error: error.response.data.error }); diff --git a/users/userservice/user-service.js b/users/userservice/user-service.js index ca8fdc1..388cce4 100644 --- a/users/userservice/user-service.js +++ b/users/userservice/user-service.js @@ -9,7 +9,7 @@ const User = require('./user-model') // GET route to retrieve an specific user by username // 'http://localhost:8002/getOneUser?username=nombre_de_usuario' -router.get('/getUser', async (req, res) => { +router.get('/getuser', async (req, res) => { try { // access to the database @@ -76,7 +76,7 @@ router.post('/adduser', async (req, res) => { // edit a user to update the total and correct question answered -router.post('/editUser', async (req, res) => { +router.post('/edituser', async (req, res) => { try { // --- find the user to be updated