Web Apps

Web Apps

Web apps are HTML-based apps that communicate with the VisionAppster Engine using the JavaScript client API. The only difference to an ordinary HTML/JS-based web page is that the Engine serves all content from a single zip file.

Let's assume you have created a web app (web page) that contains the following files:

index.html
css/style.css
img/logo.png
img/background.jpg
js/logic.js

Normally, you would copy the directory structure to the root of your web server (such as Nginx or Apache) and point your browser to the address of your server. Copying the files obviously requires e.g. ssh access to the server.

The VisionAppster Engine contains a built-in web server that can be used exactly the same way. Web apps can however be served in a more efficient and convenient way as .webapp files.

Just like apps, web apps are standard zip files. To create a web app you only need to zip the files and rename the file to .webapp:

# cd to wherever your index.html resides. Then:
zip -r my.webapp *

You can upload .webapp files to the Engine using its web interface. The Engine's web server is able to serve the contents of the file (any zip file for that matter) as if it was an ordinary directory structure. If a directory in the zip contains a file called index.html, it will be returned by the server when a client sends a GET requests to the directory. By default, the server is configured to reject requests to directories that lack index.html.

If you uploaded my.webapp using the Engine's web interface, you can start the app by clicking the "Start" button there or by browsing to http://server.address:2015/apps/web/my.webapp/. If you omit the trailing slash, the server will return you the whole app packet.

Putting everything in a single file not only makes it easier to handle web apps, but also makes serving them more efficient. All modern browsers support "deflate" transfer encoding, which means the server can return archived files without decompressing them first. The browser decompresses the data, which saves bandwidth and reduces server load.