Skip to content

Commit

Permalink
Resolvendo issues de manutenibilidade
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielRoger07 committed Sep 5, 2024
1 parent 42f8342 commit 2f7037b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,25 @@ const getUrl = (req: Request) => {

const queryString = parts[1];
const updatedPath = parts[0];
return baseUrl + updatedPath + (queryString ? '?' + queryString : '')
return baseUrl + updatedPath + (queryString ? '?' + queryString : '');
}

const videoServiceRegex = /\/videoservice/;
const userServiceRegex = /\/userservice/;
const adminServiceRegex = /\/adminservice/;

const getHost = (req: Request) => {
if (req.baseUrl.match('/videoservice')) {
if (videoServiceRegex.exec(req.baseUrl)) {
console.log("VIDEO CALLED");
return VIDEO_API_URL;
} else if (req.baseUrl.match('/userservice')) {
} else if (userServiceRegex.exec(req.baseUrl)) {
console.log("USER CALLED");
return USER_API_URL;
} else if (req.baseUrl.match('/adminservice')) {
} else if (adminServiceRegex.exec(req.baseUrl)) {
console.log("ADMIN CALLED");
return ADMIN_API_URL;
}
else {
return ''
} else {
return '';
}
}

Expand Down

0 comments on commit 2f7037b

Please sign in to comment.