Nodemon HTTP Server

Ivar Thorson bio photo By Ivar Thorson

While playing with three.js today, I needed a hot-reloading JS webserver in a real hurry to serve out content. Here’s how to start a server at http://localhost:8080/ in just three lines:

npm install http-server -g   # Install the http-server tool
cd /to/some/directory        # Change to the directory you want to serve content from
nodemon `which http-server`  # Use nodemon to restart the http-server when any content changes

If you don’t need a server that restarts, consider using:

http-server . -p 8080