Files
go-app/pkg/srv/http/opts/http_config.go
2025-12-23 11:10:13 -05:00

32 lines
806 B
Go

package opts
import (
"context"
"net"
"net/http"
)
type AppHTTP struct {
Ctx context.Context
Funcs []HTTPFunc // Handler funcs, will be wrapped with OTEL
Middleware []http.Handler // Middleware (e.g. request logging)
Handlers []HTTPHandler // Raw Handler/Mux to add, optional prefix stripping
HealthChecks []HealthCheckFunc
CustomListener net.Listener
HTTPDone <-chan any
}
type HTTPFunc struct {
Path string
HandlerFunc http.HandlerFunc
}
type HTTPHandler struct {
Prefix string // path prefix under which to serve this handler/mux, used for convenience
Pattern string // pattern match
StripPrefix bool // strip path before sending to handler/mux
Handler http.Handler
}
type HealthCheckFunc func(context.Context) error