Key features
- Trie-based routing — route matching uses a prefix tree for consistent O(k) performance regardless of how many routes you register
- Middleware — attach global or route-level middleware using the same
func(*Context)signature as handlers - Route groups — organize related routes under a shared prefix and apply scoped middleware to the whole group
- Rich context API — read URL parameters, query strings, headers, cookies, and request bodies; write JSON, XML, HTML, plain text, or file responses — all from a single
*Contextobject - Multiple response formats —
ctx.JSON(),ctx.XML(),ctx.Text(),ctx.HTML(),ctx.File(),ctx.Success(), andctx.Fail()cover the common cases without any extra setup - Built-in Logger and Recovery middleware —
DefaultApp()ships with request logging and panic recovery out of the box - Graceful shutdown —
app.RunGraceful()listens forSIGINT/SIGTERMand drains active connections before exiting - Static file serving — serve an entire directory tree with a single
app.Static()call
Hello world
Next steps
Quick start
Build and run your first Lightning app in minutes
Routing
Learn URL parameters, wildcards, and route registration
Middleware
Add logging, recovery, auth, and more to your handlers
Context API
Access request data and write responses with the Context object