Documentation
¶
Index ¶
- Variables
- func API(serverConfig APIServerConfig, badgeConfig badges.BadgeConfig, ...) error
- func APIConfigure[T api.ServerInterface](serverConfig APIServerConfig, apiInstance T, apiPrefix string) func(e *echo.Echo) error
- func EchoSwaggerUIHandler(uiPath string, swaggerUISpec []byte) echo.HandlerFunc
- func Index(c echo.Context) error
- func Live(c echo.Context) error
- func Ready(c echo.Context) error
- func Server(serverConfig APIServerConfig, assetConfig assets.Config, ...) error
- func Started(c echo.Context) error
- func StaticGet(root fs.FS, mimeType string) echo.HandlerFunc
- func StaticHead(root fs.FS, mimeType string) echo.HandlerFunc
- type APIHTTPClientConfig
- type APIServerConfig
- type LivenessResponse
- type ReadinessResponse
- type StartedResponse
Constants ¶
This section is empty.
Variables ¶
var (
ErrAPIInitializationFailed = errors.New("API failed to initialize")
)
Functions ¶
func API ¶
func API(serverConfig APIServerConfig, badgeConfig badges.BadgeConfig, assetConfig assets.Config, badgeConfigDir string) error
API launches an ApiV1 instance server and manages it's lifecycle.
func APIConfigure ¶
func APIConfigure[T api.ServerInterface](serverConfig APIServerConfig, apiInstance T, apiPrefix string) func(e *echo.Echo) error
APIConfigure implements the logic necessary to launch an API from a server config and a server. The primary difference to API() is that the apInstance interface is explicitly passed.
func EchoSwaggerUIHandler ¶
func EchoSwaggerUIHandler(uiPath string, swaggerUISpec []byte) echo.HandlerFunc
func Live ¶
Live returns 200 OK if the application server is still functional and able to handle requests.
func Server ¶
func Server(serverConfig APIServerConfig, assetConfig assets.Config, templateGlobals pongo2.Context, configFns ...func(e *echo.Echo) error) error
Server configures and starts an Echo server with standard capabilities, and configuration functions.
func StaticHead ¶
func StaticHead(root fs.FS, mimeType string) echo.HandlerFunc
Types ¶
type APIHTTPClientConfig ¶
type APIHTTPClientConfig struct {
Timeout time.Duration `help:"Default HTTP request timeout" default:"3s"`
UserAgent string `help:"User Agent string to send with requests" default:""`
}
APIHTTPClientConfig configures the outbound HTTP request globals.
type APIServerConfig ¶
type APIServerConfig struct {
Prefix string `help:"Prefix the API is bing served under, if any"`
Host string `help:"Host the API should be served on" default:""`
Port int `help:"Port to serve on" default:"8080"`
HTTPClient APIHTTPClientConfig `embed:"" prefix:"http"`
}
APIServerConfig configures local hosting parameters of the API server.
type LivenessResponse ¶
LivenessResponse is a common type for responding to K8S style liveness checks.
type ReadinessResponse ¶
ReadinessResponse is a common type for responding to K8S style readiness checks.
type StartedResponse ¶
StartedResonse is a common type for responding to K8S style startup checks.