How to install http-server on Windows

Hello,

In this post I will show you how you can install http-server on your Windows 10 system using node js environment.

http-server allows you to create your own local server on your computer system.

To make http server run on your system, you must first install node js.

Click on the below link to download node js:

https://nodejs.org/en/

You will be redirected to node js website, now click on v6.11.1 LTS (Recommended for most users) and you will be prompted to download node js msi file. Download the msi file and install when downloaded.




Now, go to start menu,
type cmd,
and right click on command prompt and click run as administrator.

 After installing node js you can check by running the following command on command prompt.

node -v
npm -v

This will show you the version of node and npm installed on your system.

Now, to install http-server, run the following commands on command prompt (make sure you are connected to the internet).

npm install -g http-server

This will take a few minutes to install http-server. After installing http-server, you will see the following on your command prompt:





 This means that http-server has been successfully installed on your windows system.

Now, to run http-server type the following commands:

http-server





You will see you local host ip as well as another ip(when connected to internet) along with the port i.e. 8080.
Now open Google Chrome and type any of the url in the url bar and hit enter. You will be able to see your txt files and html file. Also you can move to another directory and run http-server in that folder like the one in the above image.

Now you can host your file on your local server.

Comments

Popular Posts