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...