To run HTML file on localhost, we use the http-server
npm package.
To use it, we
-
install Node.js
-
In CMD, run
npm install http-server -g
to installhttp-server
globally. -
Navigate to the specific path of your file folder in CMD and run
http-server
-
Go to your browser and type localhost:8080.