zimki | documentation | search
 
Zimki Documentation - CookBook.HelloWorld

Creating a 'realm' and a 'Hello World' application

Once logged on to the portal, you will first need to create a 'realm' which is where your application will reside. Open the REALMS section in the left-hand menu. Click on the Realm List link in the submenu that appears, then click the add new realm button. Type in a descriptive name for your realm (you can always change it later) and hit the add button. Now select the realm in the drop down box just below the Realm List link to set the currently active realm, and you are ready to begin working.

Now to create your Hello World site, you must click on the JavaScript link in the left-hand menu. The screen that appears shows all your JavaScript instances (if you're using a fresh/new realm, then this will be empty). An instance is like a JavaScript file and may contain one or many functions you write in Javascript. You are free to choose how you organise these instances.

Click the Create button. Enter Main in the Instance Name box in the form that appears. In the large text box, type in the following, then hit the Create button:

function hello() { 
    return "HELLO WORLD"; 
}    
zimki.publishPath("/", hello); 

You're now done. A new instance (with name "Main") should have appeared in the table of instances and if you visit the path to your domain in a browser you should see a very simple page containing just the words "HELLO WORLD".

You can visit your domain by clicking on the Realm List link in the REALMS section of the menu, then clicking on one of the URLs for the desired domain.

What to try next?

  1. Play around with returning an HTML document or an E4X object from the hello() function.
  2. Augment the return value to include a the current date and time.

What did we do?

First we created a function, hello(), that takes no parameters and simply returns a text string. Next, we specify that we want the result of our function to be published to the path '/' in our realm. Note that the name of our function is not important; it is not bound to the name of the instance where you define it or the name of the path you publish it to in any way.

See also

Parent

CookBook