Skip to content

Commit

Permalink
Realizacao do merge da branch ajustes-sonarcloud
Browse files Browse the repository at this point in the history
Aumento da cobertura de testes e resolução de issues do SonarCloud.
  • Loading branch information
GabrielRoger07 authored Sep 6, 2024
2 parents 42f8342 + 25e829a commit d7c3095
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dotenv.config();

const app: Express = express();

app.disable('x-powered-by')
app.use(cors())

const port = 8888;
Expand Down
19 changes: 11 additions & 8 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,26 @@ 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 '';
}
}

export { getHost, getUrl }
export { getHost, getUrl }

0 comments on commit d7c3095

Please sign in to comment.