Skip to content

Commit e99de50

Browse files
author
Ahmed Elghareeb
committed
refactor: moves port listener code to the end of the server
improves readability
1 parent 369c526 commit e99de50

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

web/backend/src/Server.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ const app = express();
1313

1414
app.use(morgan('tiny'));
1515

16-
const serveOnPort = process.env.PORT || 5000;
17-
app.listen(serveOnPort);
18-
console.log(`🚀 App is listening on port ${serveOnPort}`);
19-
2016
declare module 'express-session' {
2117
// This overrides express-session
2218
export interface SessionData {
@@ -61,3 +57,7 @@ app.get('*', (req, res) => {
6157
const url = new URL(req.url, `http://${req.headers.host}`);
6258
res.status(404).send(`not found ${xss(url.toString())}`);
6359
});
60+
61+
const serveOnPort = process.env.PORT || 5000;
62+
app.listen(serveOnPort);
63+
console.log(`🚀 App is listening on port ${serveOnPort}`);

0 commit comments

Comments
 (0)