Quick tip: How to run a web server using the current path

Posted by Mark Drew on code on May 17, 2015

Tagged under webdev,npm

A lot of times you want to run a simple web server from the current path. Whether it be to see how javascript behaves or if you have linked things right in an html file. A quick tip is to install an npm package called http-server (the clue is in the name!) 

Installation is pretty simple, by the usual npm route:

npm install http-server -g

And then you just have to go to the folder you want to serve files from and do:

node bin/http-server

or the following just worked for me:

http-server

Hope that helps!




comments powered by Disqus