Skip to content

Commit

Permalink
Improvements in docker files for gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiollende committed Mar 21, 2024
1 parent 45fbba8 commit b4c7353
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 0 additions & 2 deletions gatewayservice/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,3 @@ COPY . .

# Define the command to run your app
CMD ["node", "gateway-service.js"]

EXPOSE 8000
4 changes: 4 additions & 0 deletions gatewayservice/gateway-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ app.post('/login', async (req, res) => {
const authResponse = await axios.post(userServiceUrl + '/auth/login', req.body);
res.json(authResponse.data);
} catch (error) {
res.status(error.response.status).json({ error: error.response.data.error });
console.error(error);
}
});
Expand All @@ -37,6 +38,7 @@ app.post('/adduser', async (req, res) => {
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 });
console.error(error);
}
});
Expand All @@ -47,6 +49,7 @@ app.post('/edituser', async (req, res) => {
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 });
console.error(error);
}
});
Expand All @@ -58,6 +61,7 @@ app.get('/WikiData/GetCapitalsQuestions', async (_req, res) => {
const wikiResponse = await axios.get(wikidataServiceUrl + '/WikiData/GetCapitalsQuestions');
res.json(wikiResponse.data);
} catch (error) {
res.status(error.response.status).json({ error: error.response.data.error });
console.error(error);
}
});
Expand Down
2 changes: 0 additions & 2 deletions users/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,3 @@ EXPOSE 8002
# Define the command to run your app
CMD ["node", "index.js"]

EXPOSE 8002

4 changes: 2 additions & 2 deletions webapp/src/services/auth-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const loginWithToken = () => {

export const login = async (username: string, password: string)=> {
try {
const response = await axios.post(API_URL + "/login", { username, password });
const response = await axios.post(`${API_URL}/login`, { username, password });
//const response = await axios.post("http://localhost:8002/auth/login", { username, password });
const token = response.data.token;
console.log('token:', token);
Expand All @@ -38,7 +38,7 @@ export const login = async (username: string, password: string)=> {

export const register = async (email:string, username: string, password: string) => {
try {
const response = await axios.post(API_URL + "/adduser", { username, password, email });
const response = await axios.post(`${API_URL}/adduser`, { username, password, email });
console.log('response:', response);
const name = response.data;
return name;
Expand Down

0 comments on commit b4c7353

Please sign in to comment.