31 lines
747 B
Go
31 lines
747 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
|
|
StripPrefix bool // strip path before sending to handler/mux
|
|
Handler http.Handler
|
|
}
|
|
|
|
type HealthCheckFunc func(context.Context) error
|