Engine manages route groups and builds a Gin-based HTTP handler. New() accepts functional options (WithAddr). Handler() builds a fresh Gin engine with Recovery middleware and /health endpoint. Serve() starts the server and performs graceful shutdown on context cancellation. Co-Authored-By: Virgil <virgil@lethean.io>
13 lines
265 B
Go
13 lines
265 B
Go
// SPDX-License-Identifier: EUPL-1.2
|
|
|
|
package api
|
|
|
|
// Option configures an Engine during construction.
|
|
type Option func(*Engine)
|
|
|
|
// WithAddr sets the listen address for the server.
|
|
func WithAddr(addr string) Option {
|
|
return func(e *Engine) {
|
|
e.addr = addr
|
|
}
|
|
}
|