Releases: sworteu/Express
Version 6.2.1
If you are going to deploy a service using Express to a WebServer with LifeBoat or run it in a Docker Container, then you want to configure Express Settings depending on your needs.
You could always launch the service application with arguments:
--Port=xxx
--MaxSockets=xxx
--MinSockets=xxx
--Loopback
(use Loopback Network Interface)--Nothreads
(disable MultiThreading)--Secure
(use SSL)--ConnectionType=xxx
(Xojo SSL Socket Connection Type)--CertificateFile=xxx
--CertificatePassword
--CloseConnections
(disable Keep-Alive)--SilentStart
In Docker Environments you might want a Container running an Express Instance in various environments (Production, Development). So different Log Verbosity or different Ports or other Settings are required in each environment.
Environment Variables
Creating an Express Server Instance:
Server = New Express.Server(args, AddressOf DemoHelloWorld.RequestProcess)
This will pick up both Launch Arguments and Environment Variables in the following priority:
- Launch Argument
- Environment Variable
The following Environment Variables are respected:
EXPRESS_PORT=xxx
EXPRESS_MAXSOCKETS=xxx
EXPRESS_MINSOCKETS=xxx
EXPRESS_LOOPBACK=true
EXPRESS_NOTHREADS=true
EXPRESS_CLOSECONNECTIONS=true
EXPRESS_SILENTSTART=true
Note: you need to specify the value true
for the last four Environment Variables.
The SSL related launch arguments have not been implemented.
In hosted environments you could/should use a Gateway (e.g. nginx) in front to handle SSL (and certificate renewals) and Load Balancing.
Demo 1: Hello World
This Demo has been updated to display Express Server Infos.
Express | Lifeboat
This ScreenShot shows how Environment Variables have been configured in LifeBoat.
The deployed Express instance picks them up:
Demos
The provided Demos have been updated to respect Launch Arguments and Environment Variables.
In DebugBuild
s the Loopback Network Interface (localhost
, 127.0.0.1
) is being used by default.
Express-Demo-Console
Now uses a demo in the following priority:
- Launch Argument:
--Demo=1
- Environment Variable:
EXPRESS_DEMO=1
- if no set: displays a choice and asks which demo to use
This now allows to
- Build the Express-Demo-Console.xojo_project without modifying any code
- Deploy to a webserver (e.g. using Lifeboat)
- Set Environment Variable
EXPRESS_DEMO=1
- Stage - and enjoy/test the Demo 1
- Set Environment Variable
EXPRESS_DEMO=2
- Stage - and enjoy/test the Demo 2
- Set Environment Variable
- Deploy to a webserver manually
- Launch with Arguments
--Port=xxxx --Demo=1
(or set the Environment Variables) - Enjoy/test the Demo 1
- Launch with Arguments
--Port=xxxx --Demo=2
(or set the Environment Variables) - Enjoy/test the Demo 2
- Launch with Arguments
Version 6.1.0
This release introduces Express.EventLogHandlerDelegate
Express is designed to be a standalone component that can be dropped into any Xojo project.
Each Xojo project might want to handle Logs differently.
Express provides a default logging facility in: Express.EventLog
TargetConsole: write to StdOut
TargetDesktop: write to System.DebugLog (see Xojo's Documentation)
If an application wants Express to redirect Logs to it's own Logging facility, then Express needed to be modified accordingly.
Express 6.1.0 decouples this hardcoded requirement by introducing the Express.EventLogHandlerDelegate
.
A Xojo project using it can now specify which method (that implements the delegate) an Express
instance
should use as it's Event Log handler.
Usage:
// Configure App to handle Express EventLog with LogLevel Warning
Express.EventLogLevel = Express.LogLevel.Warning
// Assign the Express.EventLogHandlerDelegate to tell Express which method is processing the EventLogs
// Comment out or Assign Nil if you want to use Express's default EventLog-Handling
Express.EventLogHandler = WeakAddressOf ExpressEventLog
This release also introduces the Express Demo GUI
This repository is now a MonoRepo containing two example projects:
Express-Demo-Console.xojo_project
Express-Demo-GUI.xojo_project
The new "Express Demo GUI" shows how to:
- Use Express in a Desktop application
- Switch between the provided Demos on the fly
- Adjust Log Level on the fly
- Use the recently added Delegates:
Express.RequestHandlerDelegate
Express.EventLogHandlerDelegate
Fixes
- Multipart Forms Demo (the issue had been in the
Express.Request
object). DataAvailable
usesLookahead.Bytes
to determine if theContent
has been fully received- Fix in
Method BodyGet
, so that Multipart Form Content is no longer stripped DataGet
andBodyGet
in now called in the methodProcess
Demo
A Copy File Post Build Step now copies the demo's ressources to the Resources Folder.
All demos have been updated to look for the resources in SpecialFolder.Resources.
Note: The Multipart Forms Upload will go into the following folder: SpecialFolder.(Desktop | UserHome).Child("express-demo-uploads")
Demos have been updated with Nil
checks for Request.Server
(which is a WeakRef
).
Server might be Nil
if stopped while Request
is still alive.
If you don't assign an own Event Log Handler (see above), then Express
will continue to use it's default logging mechanism.