DEV Community

Lívia Silva Santos
Lívia Silva Santos

Posted on

Needed a Web Server, quick and easy..

Today I was asked to create a simple static html page that reads a json file with some information to show it on a grid. I've created the structure, added some bootstrap css files and opened the index.html on a browser and an error...

Reason: CORS request not HTTP

The solution was to run a web server to access the static html page. I needed it quick and easy. Found out I could install it via npm and run it on the base directory.

So, to install the server:
$npm install -g http-server

And to run it:
$cd my_project_base
$http_server

And voilá!

Starting up http-server, serving ./
Available on:
http://:8081

Top comments (1)

Collapse
 
moopet profile image
Ben Sinclair

Another quick one is python -m SimpleHTTPServer which will work on most systems (most systems come with Python installed) and doesn't require any additional modules to install.