Description
The server's listening port has no default value, and the fallback that used to exist is commented out, so a missing PORT env var results in app.listen(undefined, ...).
Details
backend/src/server.js:
const app = express();
// const PORT = process.env.PORT || 5001;
...
app.listen(process.env.PORT, () => {
console.log("Server listening at port number: " + process.env.PORT);
});
The PORT fallback is commented out, and the raw process.env.PORT is passed straight to app.listen. If PORT isn't set (e.g. a fresh clone using .env.example, which does set PORT=5001, but any environment where it's omitted), Express falls back to picking a random available port with no clear log message, making the failure confusing to diagnose.
Expected
The server should default to a sensible port (e.g. 5001) when PORT is not set, and log the actual port it bound to.
Suggested fix
const PORT = process.env.PORT || 5001;
...
app.listen(PORT, () => {
console.log("Server listening at port number: " + PORT);
});
I would like to work on this issue. Could you please assign this issue to me?
Description
The server's listening port has no default value, and the fallback that used to exist is commented out, so a missing
PORTenv var results inapp.listen(undefined, ...).Details
backend/src/server.js:The
PORTfallback is commented out, and the rawprocess.env.PORTis passed straight toapp.listen. IfPORTisn't set (e.g. a fresh clone using.env.example, which does setPORT=5001, but any environment where it's omitted), Express falls back to picking a random available port with no clear log message, making the failure confusing to diagnose.Expected
The server should default to a sensible port (e.g. 5001) when
PORTis not set, and log the actual port it bound to.Suggested fix
I would like to work on this issue. Could you please assign this issue to me?