Ever come across an error like this while developing a static site on your local machine?
XMLHttpRequest cannot load file://path/to/file. Received an invalid response. Origin ‘null’ is therefore not allowed access.
The error will go away once you deploy your site to a real server and files are served over HTTP, and thankfully you can replicate that behavior on your local machine! Enter the npm library ‘http-server’:
First install the package globally on your machine
$ npm install -g http-server
Then navigate to your project folder that includes index.html at the top level
$ cd /path/to/myApp
Then start the server
myApp $ http-server
View in your browser
And you’re done!