Simplest possible app

This page describes the most basic app you can build with Kanso

Directory layout

example-app/
  |-- index.html
  |-- kanso.json

Create a new directory called example-app to which we'll add the two files index.html and kanso.json.

kanso.json

{
    "name": "example-app",
    "version": "0.0.1",
    "description": "The simplest possible app",
    "attachments": ["index.html"],
    "dependencies": {
        "attachments": null       
    }
}

The kanso.json file tells Kanso how to build your app. You must at least include a name, version number and description. The name will be used for the id of the design doc.

We've included one dependency, the attachments package. Attachments are static files that will be served by the app. This package will load attachments from the filesystem and add them to the design doc. We've also added an attachments property with a list of files. In this case, just index.html. This tells the attachments package which files to load.

index.html

<h1>Hello, world!</h1>

A trivial example page we'll be using for our app.

Pushing the app

kanso install
kanso push http://localhost:5984/example

The first command will install the dependencies for our app, in this example the only dependency is the attachments package. The next command will push the app to the CouchDB database at http://localhost:5984/example, if the database doesn't exist, Kanso will create it.

OK: http://localhost:5984/example/_design/example-app/index.html

Once your app has been successfully uploaded, you'll see the above message. You may be prompted for a username and password if your CouchDB is not in admin party mode. Visiting the URL http://localhost:5984/example/_design/example-app/index.html should display the "Hello, world!" message.

Next

Try modules for javascript instead of attachments: Using CommonJS modules