Simple local Javascript and css dev environment

d3’s doc used to have this list on it’s wiki, but it is now only showing npm’s http-server, which is great (and my default) but I miss the list so here it is.

How to start a local web server in different languages

All following will open the directory in http://localhost:8080/

Python’s built-in server:

python -m SimpleHTTPServer 8080 &

or for Python 3+

python -m http.server 8080 &

If you have PHP installed you could try

php -S localhost:8080

or if you are running Ruby you can use

ruby -run -e httpd . -p 8080

Or if you are running nodejs you can do

npm install http-server -g
http-server

Another option is to start a local jetty instance, by using the jetty-runner library with the JVM already installed on your system.

java -jar jetty-runner-9.3.0.M0.jar --port 8080 .