Execution flow

Steps

Script

In object oriented programming, typically, there are classes, or some kind of base objects, which can be extended, forming an inheritance chain. Typically, methods inherit along that chain, but they can be overridden at higher levels.

Boomla is object oriented, and it works just like that. In Boomla, we have applications, that are stored in files. These applications can be extended, forming an inheritance chain. Every file has a type property, holding a path to an other file, which is used for specifying this chain. In Boomla, this is called the type chain.

In Boomla, methods are stored in individual files as well, that are stored as children of the application file. For example, to serve a request, you would create a .Request file. To create instances of this app, you would create a new file, and set its type to point the path of the application. Although the instance itself has no .Request file, it exists on its type chain, so it will be capable of serving requests.

Let’s see this in action. Click this Open in Playground button to start a website in the same state as I am.

To work with the filesystem of this website, click the IDE on the Toolbar. Create a file to hold our application. The file type of any application must be app-1. To serve requests, let’s create a .Request file inside it. Note the dot! Every time a request comes in, this file will be executed. To select a virtual machine to execute your code, you have to set the type of your .Request file. For example, let’s choose sjs-3 for running JavaScript code, and see an example.

response.body('hello world')
response.attrStr('content-type', 'text/html')

Return hello world, set content type to HTML.

Visiting our application file, it works.

To create an instance of this application, let’s create a hello file, and set its type to the path of our application.

Because the .Request file exists its type chain, it will readily serve requests.

Of course, you can make longer type chains too. Let’s create a hello-2 file, set its type to point to the hello file, and visit it.

There are many benefits to this approach, but that’s the topic of other intros.

A single web page may contains multiple contents. On the filesystem, this means there will be a file for the page, and a file for each of the contents.

Contents can be displayed by simply executing the file’s .Inline method.

The next video will cover how to write content apps.

To help you with the coding, you will often find a gallery below the video that will walk you through the steps, as jumping around in the video may be annoying.

That’s it!