Installing a Node Web Server using http-server

Leave a comment

Node has several web servers available for installation, including http-server:

To install, type:

npm install http-server -g

To start the server, type:

http-server

This will start the web server at the addresses:

Opening a web page at this address will display the contents of the current directory:

If we create a folder called webserver with one file, index.html, and browse to this directory, we see the index file is displayed:

We can specify the web server directory and port with the command:

http-server C:/webserver -p 7777

This produces:

And if we browse now we see the index page directly:

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, BI, Web, Cloud and Data Science.

carldesouza.comLinkedIn Twitter | YouTube

 

Leave a Reply

Your email address will not be published. Required fields are marked *