Zero config HTTP Servers for testing websites
Today I am going to show you 3 http servers which can used without any configuration to view and test your websites in local development which are built using HTML and JavaScript
I am going to use the below HTML project from GitHub for demo.
https://github.com/sureshgadupu/presenta-slideshow-demo
i) Live Server
Live server is http server available as VS Code IDE extension.
After installing the extension, You can start and stop the server by right-clicking on the page you want to view
By clicking on the “Open with Live Server” option we can view the webpage in action in browser.
One advantage with Live Server is you can directly open the page you want to view/test.
ii) http-server
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.
http-server
is a npm module so node js should be installed on your computer.
We can start using this http server without installing with below command
npx http-server [path] [options]
Code language: Java (java)
For available options visit the link
Now open the browser and navigate to one of IP address and port given in Available on section in above image
We can also install http-server in our system.
Below command will install http-server
globally so that it may be run from the command line anywhere.
npm install --global http-server
Code language: Java (java)
http-server [path] [options]
Code language: Java (java)
iii) Web Server for Chrome
Web Server for Chrome
is a http server available as browser based extension for chromium based servers.
You can install the Web Server for Chrome by visiting link from chromium based browsers
Once installed, server will be available under apps/extension section of browser
Now click on the Web server icon to star the server. Click on the choose folder button and select your project folder.
Now click on the url available under Web Server URL (s) to view website on browser