Create an HTTP server using 1 command

--

Create an HTTP server using 1 command

Today we will learn how to create an HTTP server for the local development of sites, it is a very cool tool to do tests and visualize how the website will look when it is hosted.

Pre-requisites:
Node.js is installed on your machine.

Create a folder for your project and open it in your favorite editor.

Create an HTML file(index.html) with the following code:

<!DOCTYPE html>
<html lang="en">
<body>
<h1>Hello World</h1>
</body>
</html>

Open the terminal and type the following command:

npx http-server

This command will create a local server on port 8080. Open your browser and type the following URL:

http://localhost:8080

Done! You have created your first local server.

Create an HTTP server using 1 command

--

--

Rahul Sharma (DevsMitra)

I’m a technology enthusiast who does web development. Passionate to contribute to open-source projects and make cool products.