How to use live-server as a small development server

Saturday, June 20, 2020


Live-server is a small development server with live reload capability. Use it for "hacking" your HTML/JavaScript/CSS files, but do not to deploy the final site.

There are two reasons for using this:

AJAX requests don't work with the file:// protocol due to security restrictions, i.e. you need a server if your site fetches content through JavaScript. Having the page reload automatically after changes to files can accelerate development.

How To

Create a directory ./www

1mkdir ./wwww

Edit a simple HTML page such as index.html in the ./www directory

2 <header></header>
3 <body>
4 <h1>This is a simple test</h1>
5 </body>

Run the command live-server to expose the directory

1live-server ./www

Subscribe to our Newsletter

We deliver high quality blog posts written by professionals monthly. And we promise no spam.

elitizon ltd.

© 2020 elitizon ltd. All Rights Reserved.