Getting Started
Install BoxLang Express, write a minimal server, and run it.
Prerequisites
You need the BoxLang CLI itself installed (e.g. via bvm, the BoxLang version manager).
Installing BoxLang Express
box install boxlang-express or install-bx-module boxlang-express
Your first server
Once the module resolves, boxExpress() and its companion middleware BIFs (boxExpressJSON(), boxExpressStatic(), etc.) are available globally — no import needed. Save this as app.bxs:
bxsapp = boxExpress()
app.get( "/", ( req, res ) => {
res.send( "Hello World" )
} )
app.listen( 3000, ( port ) => {
println( "listening on #port#" )
} )
Running the server
Run it directly with the CLI:
bashboxlang app.bxs
By default app.listen() blocks the calling thread — it keeps the process alive for you, the same role Node's event loop plays for an Express app, since BoxLang's CLI runtime has no equivalent of its own. Stop it with Ctrl-C; see Health Checks & Graceful Shutdown for exactly what happens on shutdown.
Need a config file (datasources, module settings, etc.)? See Configuration — the CLI doesn't pick one up automatically, so there's a flag for it.
Dev-mode auto-reload
Add one line to restart the process automatically whenever a watched .bx/.bxs file changes (.bxm views don't need this — they're re-read from disk on every request already):
bxsapp.set( "reloadOnChange", true )
Full mechanics are covered in Auto-Restart.
Where to go next
The rest of these docs follow the module's own reference, one page per feature:
- Core — App, Routing, Request, Response, Views, Error Handling
- Middleware — Middleware, File Uploads, Sessions, Security Headers, CORS, Rate Limiting, CSRF Protection
- Realtime and background work — Server-Sent Events, WebSockets, STOMP, Scheduler, Cluster Support
- Operations — Testing, Observability, Health Checks & Graceful Shutdown, Auto-Restart
- Project — BoxLang Gotchas, Hacking on BoxExpress