http-server is a simple, zero-configuration command-line static HTTP server. It is powerful enough for production usage, but it's simple and hackable enough to be used for testing, local development and learning.


Check if http-server package is installed on you system

npm -g list

Install http-server package to create a local web server for testing non-static web content like form action or JS elements Use -g to install globally, so that it may be run from the command line anywhere

npm install -g http-server

Go to the root folder where your HTML or Index file is present and open command prompt from the root folder Then start, a http-server using command. This will start the server in the root folder.


You can specify a path and option while starting the server. Default path is root folder shown in Command Prompt / Terminal

http-server [path] [options]

By default caching is on, so changes may not reflect on refresh. Use option -c-1 to disble caching

Last updated