When developing small javascript projects I find the overhead of configuring a
virtual host in Apache or nginx cumbersome. The http-server module in node.js allows
you to easily start a webserver within your project folder.
Make sure node.js is installed and install the following module:
npm install http-server -g
The -g option install the module as a global one, meaning that you can start the
webserver from every folder. You can now go to any folder you’d like and issue the
following command:
http-server
This will result in the following output:
Starting up http-server, serving ./ on: http://0.0.0.0:8080
Hit CTRL-C to stop the server
You can now access all files in the folder via http://127.0.0.1/ in your webbrowser.
More information on this module can be found on the http-server project page. There
are several configuration options for configuration the port, ip address, etc.