For Node.js applications, when to use port 3000 versus 8080?

I read some tutorials, and although most of them use port 3000 for node applications ... some of them use port 8080 instead. I wonder what recommended practice is, and under what circumstances should we use another. Any recommendations?

+7
port
source share
3 answers

There is no official post from node.js end, as there are no official comments regarding this.

You will find many people who are confused that using port 80 and 443 for http and https, respectively, is the standard. This is the standard for a standard PC, and this data was disclosed in a document released in 1994 with the support of TB Lee.

For general network use, try not to use ports below 1024, because otherwise you would need to have root access on the network server to start the process. As the other guy said, just use any unused port and everything will be fine, but above 1024, or you need root access.

I suggest you use any reverse proxy engine to make things more convenient and convenient. Preferably nginx, they will even help you have multiple instances of your server that will help you use the server correctly. Although there is no need to use a reverse proxy server, because everything will work without it.

I suggested a reverse proxy server, because, as a rule, we do not fully use the capabilities of the server available for use, and therefore, the use of clusters will help us improve performance.

Note. If you are not going to use the application in a real domain, and you are just trying to do something, please ignore part of the reverse proxy server, it is only important that you scale the application.

References

Click here

+4
source share

You use port 3000 when port 8080 is used by another program on your server (maybe another node server, it is traditionally used by an http proxy). Then, if port 3000 and 8080 are already in use, you can use 3001 or 3002 or 30000 or 10000. Any unused port will do.

+2
source share

I think that both ports "3000" and port "8080" are used to develop the goal in the textbooks you read, in such cases one works well, and neither is better than the other. Therefore, you can simply choose one to use. However, after you finish the development and want to deploy your project into production, select the appropriate port, for example, "80" for "http" or "443" for "https", as you need.

+2
source share

All Articles