'Node server is not running and Now errors are shown in the terminal

I have a node server which when I run is not showing server is running at port 5000 for example. Also, I got 0 errors in the terminal.

My question is how to check for errors that are causing the server not to run ?

app
  .listen(port, () => {
    console.log(`Server is running at port: ${port}`);
  })
  .on('error', function (err) {
    console.log(err);
  });

Here is the code that I use to run to listen to requests.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source