1

I'm trying to get started with node.js.

For example en Java and .net programmer often use the port 8080? Is there a convention like that in node.js?

I know that any port above 1024 will do it but I will like to follow the conventions so working with other programmers would be easier.

I heard that it is Ryan Dahl's (the creator of node.js) favorite port. Where can I find what is his favorite port?

  • Not sure whether it is a convention or not but, in 2010 Ryan says that his favorite port was 8000; assuming that he hasn't changed his mind the answer is 8000. Check his talk Parallel Programming with Node.js around the minute 25. – user454322 Dec 6 '14 at 14:10
  • 3
    Isn't the point making sure your application uses a unique port? – Rotem Dec 6 '14 at 14:30
  • 1
    Port 8080 is the official ICANN-designated Alternate-HTTP port. Ports 8000 and 8888 do not enjoy such a designation. That said, I don't think it much matters what port you use in development when interoperability with other systems is not a concern. (When interoperability is a concern, you may want to simply use whatever final port you plan you use, like 80 for HTTP.) – apsillers Dec 8 '14 at 15:08
2

The traditional web server port is 80. However, this is a port in the privileged area on many systems (requiring the administrator of the machine to run the program that listens to that port).

This rules out 80 and 800 as options for ports to set up a server on. The next value in that series would be 8000. Many web servers are configured to listen on port 8000 (or the developers just use that as a convention - more on this below). Some go to 8080, or 8888 for their development port areas, but 8000 is the next value in the series. The key bit being that they are unique. You can't have two different programs both listening to the same port.

Tomcat happens to have its configuration files shipped to listen on port 8080 - though this may have changed with other version. This may be because some web developers are also running an apache httpd server on port 8000 (I've occasionally run that configuration myself - it's not uncommon) as part of the technology stack in use.

That the default configuration of a program that responds to web requests listens on port 8000 should be no surprise at all and is a convention for development servers that dates back since at least when I fired up NCSA HTTPd on port 8000 on a machine I didn't have root on.

This is a convention for development web servers or things you don't want root running (application servers vs a slim httpd proxy) and is unlikely related to any developer's favorite numbers. It's a port. It's a convention for developers that long predates Node (or even Javascript).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.