Using Aloe Express in Xojo Web Projects

While Aloe Express was originally designed for use in Xojo console projects, it can also be used in Xojo Web projects.

To get started, create a new Xojo Web project. Then add the Aloe Express module into it.

Configure the App.Open Event Handler

Add an Open event handler to your app. In it, create an instance of the AloeExpress Server class, and then call the Start method. For example...

Add an App.RequestHandler Method

Next, add a method named RequestHandler to the app. This is the method that the server will hand requests off to. Be sure to add a Request (AloeExpress.Request) property to the method. For example...

Run the App

Next, run the app, and then in your browser, send a request to http://127.0.0.1:8080. You should see a "Hello, world!" response.

How - And Why - This Works

By creating an instance of the Aloe Express server in the app's Open event handler, we're essentially replacing the framework's standard server. When the Aloe Express server is run, one of the last things that it does is perform an endless loop in which it calls App.DoEvents. This prevents the framework's standard server from ever starting up.

Next Steps

That's all there is to using Aloe Express in Xojo Web apps. To learn more about Aloe Express, check out Getting Started With Aloe Express.