Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddHealthCheck ¶
AddHealthCheck adds a standard health check endpoint to a Huma API
func CustomHealthCheck ¶
func CustomHealthCheck(api huma.API, path string, healthFunc func(ctx context.Context) (*HealthResponse, error))
CustomHealthCheck allows users to provide their own health check logic
Types ¶
type HealthResponse ¶
type HealthResponse struct {
Body struct {
Status string `json:"status" example:"ok" doc:"Service status"`
Message string `json:"message,omitempty" example:"Service is running" doc:"Optional status message"`
Version string `json:"version,omitempty" example:"1.0.0" doc:"Optional service version"`
}
}
HealthResponse represents a standard health check response
type StaticConfig ¶
type StaticConfig struct {
// AssetsDir is the subdirectory within the embedded FS (e.g., "assets", "dist")
AssetsDir string
// SPAMode enables Single Page Application routing (serves index.html for non-file routes)
SPAMode bool
// DevMode disables static serving (for development when using dev server)
DevMode bool
// APIPrefix excludes paths starting with this prefix from static serving
APIPrefix string
}
StaticConfig configures static file serving behavior
type StaticResponse ¶
type StaticResponse struct {
StatusCode int
ContentType string
CacheControl string
Body []byte
NotFound bool
}
StaticResponse contains the result of static file processing
func ServeStaticFile ¶
func ServeStaticFile(assets embed.FS, config StaticConfig, path string) StaticResponse
ServeStaticFile is the core logic for serving static files, router-agnostic
Click to show internal directories.
Click to hide internal directories.