User Guides v3.0

Network Developer Guide

This page describes resources of interest to developers working with Cantabile's Network API and Network Server.

Network API

The network level API allows minimal control of Cantabile using a REST API and full control via a WebSocket interface.

Documentation is available here.

JavaScript API

The cantabile-js JavaScript library provides a wrapper library for the network API and provides easy control of Cantabile from both Node.JS and the browser.

Documentation:

Web Folders

Cantabile's built-in web server serves static content from special .webfolder folders in the resource folder.

A .webfolder can be either a sub-directory of the resource folder, or zipped set of files renamed with a .webfolder extension.

When the web server starts, any .webfolder files/folders are mounted using the name of the web folder as the url. For example, everything in zipped web folder lib.webfolder would be available as http://localhost:35007/lib/

The special web folder Root.webfolder is mounted as the root url and contains the default index.html file.

Files ending in .html can be accessed using a url without the .html extension and URLs referring to a directory will server the default file index.html if it exists.

Building Files on Demand

For non-zipped webfolders (ie: actual directories), files can be created/updated on demand by placing a .make or a .bat file of the same name.

For example, in the Root.webfolder the file styles.css is generated from the file styles.less. By placing a file styles.css.make in the same folder, Cantabile will automatically run the make file to generate the dependant file.

eg: styles.css.make might contain:

styles.css : styles.less
    lessc styles.less styles.css

Similarly a styles.css.bat could be used for similar purposes. Use of a .make file requires a GNU compatible version make is available on the system path (and the above example also assumes lessc is available on the system path).

Built-in Web Content

The built-in web content can be used as a reference and is available here.

Of particular interest might be:

  • The default index.html page (see here)
  • A standard set of libraries including the cantabile-js library, jQuery, Vue, Hammer etc... available as /lib/
  • A built-in copy of the Open-Sans font available as @import url("/fonts/open-sans/open-sans.css");