Examples Templates Store Pricing Docs Turbo CSS Blog Introducing Turbo UI Named buckets Turbo CSS is Tailwind CSS on steroids Introducing Turbo CSS, the most advanced web-design language Calculate how much storage you use Better login system Collaboration settings Filesystem and Database are not cutting the problem space right What I'm working on 64bit File node IDs New how-to videos Creating buttons gets easier Introducing reusable components HTTPS by default Introducing the Boomla Theme CDN for faster pageloads Write your own website builder on top of Boomla On On composition Shared admin access A fresh config editor Building a multi-purpose theme A filesystem to replace your CMS New file link type: scope Mobile editing support Inline file wrapping changed Package sandboxing New PHP-like JavaScript engine [sjs-4e] Send emails to the website owner New JavaScript engine [sjs-4] A better editing experience New email service provider Glossary and other changes New panel changes Improved registration flow Boomla goes multiplayer Using local dev tools Why Boomla doesn't need Git File Panel Let's build a community Automatic updates Improved sjs-3 API New Frontend CSS modules Work offline with Boomla Faster page loads via caching Drag & drop supercharged Supporting CommonJS modules  Paranoid about loosing data IDE usability improvements Simple App install flow Meetups in Budapest Goodbye broken links Flow control from user space Customizing apps Contextmenu support for apps Deprecating the .Class file Hello Changelog Embedding 3rd party plugins Introducing Tools Installing apps just got amazing Public beta Host on our servers Simple deploy with push/pull Version Control for the Web 350M files on a 1TB disk 2 weeks in review
Control Panel

Flow control from user space

2016-11-26

This is post is aimed at developers.

With the release of Boomla v0.4.1, the built-in sjs-3 interpreter landed support for inlining apps. Until now this was the privilege of the html-1 interpreter, which provided significantly less options to take advantage of the powerful runtime Boomla has to offer.

Example

Let’s cut to the meat. This example prints hello world and inlines a gallery next to it.

var body = 'hello world'
var gallery = f.select('gallery')
body += os.inline(gallery)
response.body(body)

This is precisely ONE function call. There is no process to start and stop. There is no process in the first place, thus you don’t need to monitor if it crashed. It’s just like a function call, yet the application that is run may even be written in a different programming language.

Error handling

If the application crashes, Boomla handles it for you and will return a nicely formatted error message. What about the HTTP status-code? Boomla will also update it for you.

3xx beats 2xx 4xx beats 3xx 5xx beats 4xx

Otherwise, the first status-code from the same group is returned. For example, if 2 files that are inlined return 2 redirections, the first one will take precedent.

Full control, no magic

Magic? No. While this form of using os.inline() is certainly the most convenient form, it does limit your options. What if you want to take full control over what is returned to the user? You can. The os.inline() call has other optional arguments, like the response file. The response file is the one that will be decorated with the response status-code, redirect location and head tags required by the inlined file. To catch these values and control yourself what you want to pass higher up the call-chain, just create an empty file and pass it to os.inline() instead of the response file.

This way you have the choice between convenience or full control.

Real-life use case

A typical example is a generic slideshow app. Generic, because it will show and slide anything you give it. Not only images. You could equally give it some text or a video player.

Here is the docs of os.inline().


Cheers,

you can follow me on Twitter