HTML5 Basics Course
Local HTTP-server
To work with a web-worker, it is required that the page be opened through the HTTP, and not directly from the disk, so you need to install a local HTTP-server. You can do this manually by specifying the “public” folder of the repository as the root directory. Or with the help of Vagrant
:
- install Vagrant;
- go to the repository folder and run
vagrant up
; - open http://127.0.0.1:8080 in browser;
- stop
Vagrant
by commandvagrant halt
.
If the HTTP-server does not start, you need to log into the console and start the server manually:
cd repository-folder
vagrant ssh
sudo /etc/init.d/nginx start
External dependencies
All these dependencies are automatically loaded when the virtual machine starts. If this does not happen, you need to manually run commands:
cd repository-folder
vagrant provision
Or:
cd repository-folder
vagrant ssh
cd ~/www/public
bower install jquery
bower install bootstrap
bower install handlebars
bower install localforage
Other dependencies cannot be loaded using bower
, so the scripts were copied to the repository (along with the license):
This could have been avoided by using npm
(webpack
, yarn
, etc), but at the stage of connecting these dependencies, bower
was already used, so I decided not to complicate and not rewrite everything.
Checking requirements
localForage works with several types of storage depending on their availability in current browser: