NewApp() for full control over configuration, and DefaultApp() as a batteries-included shortcut. Both accept the same Config struct.
Config fields
The name shown as a prefix in all log output produced by the application’s built-in logger.
A custom JSON marshaling function with the signature
func(v any) ([]byte, error). When omitted, Lightning uses encoding/json.Marshal.A custom JSON unmarshaling function with the signature
func(data []byte, v any) error. When omitted, Lightning uses encoding/json.Unmarshal.A handler invoked when no route matches the incoming request. The default handler responds with
404 Not Found as plain text.When
true, Lightning registers a GET /__debug__/router_map endpoint that returns all registered routes as JSON. Useful for verifying route registration during development.The maximum number of bytes the server reads from a request body. A value of
0 means unlimited. Requests that exceed this limit are rejected by the underlying fasthttp server.NewApp()
NewApp accepts zero or one *Config argument. Any field you leave at its zero value falls back to the Lightning default for that field.
No configuration (all defaults)
Custom configuration
You only need to set the fields you want to override.
NewApp merges your Config on top of the defaults, so unset fields keep their default values.DefaultApp()
DefaultApp is equivalent to calling NewApp() and then registering both the Logger and Recovery middleware:
DefaultApp when you want structured request logging and panic recovery without any extra setup: