The line const port = 5000 || process.env.PORT; always assigns 5000 to port because 5000 is a truthy value. This prevents the server from using the port specified in the environment variable process.env.PORT. The correct approach is const port = process.env.PORT || 5000;
The line const port = 5000 || process.env.PORT; always assigns 5000 to port because 5000 is a truthy value. This prevents the server from using the port specified in the environment variable process.env.PORT. The correct approach is const port = process.env.PORT || 5000;