Iliad Framework, how to create your first application

Hi. In this post we will create a basic web application using the Iliad Framework.

Please consult the previous post if you need to install the web framework in your image.

An Iliad web application consists in a class that extends from ILApplication so lets create one:

<span class="nc">ILApplication</span> <span class="nf">subclass:</span> <span class="ss">#LcBlogHelloIliad</span>
  <span class="nf">instanceVariableNames:</span> <span class="s">''</span>
  <span class="nf">classVariableNames:</span> <span class="s">''</span>
  <span class="nf">poolDictionaries:</span> <span class="s">''</span>
  <span class="nf">category:</span> <span class="s">'LeonardoBlog'</span>

Now we need to declare where our application will be published. To configure the starting point for our web app we need to override the path class method:

<span class="c">"LcBlogHelloIliad class>>path"</span>
<span class="nf">path</span>
    <span class="o">^</span> <span class="s">'leonardoBlog'</span>

Every Iliad Application implements the Front Controller partner. This means that it will receive every request addressed to the application from the http server.

The index controller will handle the request to the /leonardoBlog address, just like your index.html file. Let’s implement an index controller on the instance side of our LcBlogHelloIliad class, remember to put this method on the controllers protocol:

<span class="c">"LcBlogHelloIliad>>index protocol controllers"</span>
<span class="nf">index</span>
    <span class="o">^</span> [ <span class="o">:</span><span class="nv">e</span> <span class="o">|</span> <span class="nv">e</span> <span class="nf">h1:</span> <span class="s">'Hi world!'</span> ]

Now, to check that everything is correct, you can go to http://localhost:7070/leonardoBlog. The controller method must return a “buildable object”. What’s a buildable object?

A buildable object can be many things… widgets, applications, and blocks of code. In the example I returned a block that, from an ILHTMLBuilderElement create an h1 HTML element.

Please browse the code from the ILHTMLBuilderElement class. You will find many useful methods to create basically every HTML element you want.