Running our API on port 80
We are currently running our API server on port 8080
, whereas the standard port for HTTP requests is port 80
. It would be really inconvenient, and thus bad for user experience, to ask the consumers of our API to attach a port number to the URL for every request.
Therefore, let's change the port that Express is listening on from 8080
to 80
and see what happens. Change the SERVER_PORT
environment variable to 80
:
SERVER_PORT=80
Then, stop and delete the PM2 application, and run the serve
script again. When we run it again, it will initially be successful:
hobnob@hobnob:$ npx pm2 delete 0; yarn run serve ... [PM2] Done. ┌───────┬──────┬────────┬───┬─────┬─────────┐ │ Name │ mode │ status │ ↺ │ cpu │ memory │ ├───────┼──────┼────────┼───┼─────┼─────────┤ │ index │ fork │ online │ 0 │ 0% │ 16.9 MB │ └───────┴──────┴────────┴───┴─────┴─────────┘
However, when we check its status again, PM2 will show you that the application has errored, and it has tried to restart it 15...