Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit d5683d4

Browse files
Merge pull request #44 from topcoder-platform/dev
when sending an error, return instead of executing the rest of the code
2 parents b533305 + f9dc2b5 commit d5683d4

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

server.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ app.get("/micro-frontends-config", async function (req, res) {
2929
mfeRoutes = await fsPromises.readFile(path.join(configPath + env_config.mfeConfigPath))
3030
break;
3131
default :
32-
res.send({'error': { message: "Check application environment", code: 500 }})
33-
break;
32+
return res.send({'error': { message: "Check application environment", code: 500 }})
3433
}
3534
res.send(mfeRoutes);
3635
});
@@ -52,8 +51,7 @@ app.get("*", async function (req, res) {
5251
mfeIndex = mfeIndex.data
5352
break;
5453
default :
55-
res.send({'error': { message: "Check application environment", code: 500 }})
56-
break;
54+
return res.send({'error': { message: "Check application environment", code: 500 }})
5755
}
5856
let mfeRoutes
5957
switch (process.env.APPENV.toLowerCase()) {
@@ -67,8 +65,7 @@ app.get("*", async function (req, res) {
6765
mfeRoutes = await fsPromises.readFile(path.join(configPath + env_config.mfeRoutesPath))
6866
break;
6967
default :
70-
res.send({'error': { message: "Check application environment", code: 500 }})
71-
break;
68+
return res.send({'error': { message: "Check application environment", code: 500 }})
7269
}
7370
let mfeIndexHtml = htmlParse.parse(mfeIndex)
7471
let singleSpaMain = mfeIndexHtml.querySelector('#single-spa-main')

0 commit comments

Comments
 (0)