Versions in this module Expand all Collapse all v1 v1.1.1 Jan 16, 2024 Changes in this version + func Decode(w http.ResponseWriter, r *http.Request, v interface{}) error + func Error(w http.ResponseWriter, r *http.Request, err string, code int, ...) + func LoggerFromRequest(r *http.Request, l *zap.SugaredLogger) *zap.SugaredLogger + func NewServer(addr string, logger *zap.SugaredLogger, a API, opts ...Option) http.Server + func NotFound(w http.ResponseWriter, r *http.Request, extras ...ProblemExtra) + func Problem(w http.ResponseWriter, r *http.Request, title, detail string, code int, ...) + func Redirect(w http.ResponseWriter, r *http.Request, url string, code int) + func Respond(w http.ResponseWriter, r *http.Request, code int, data interface{}) + func SetDetails(r *http.Request, path string, params map[string]string) *http.Request + func URLParam(r *http.Request, name string) string + type API interface + Endpoints func() []Endpoint + type CorsMiddleware func(http.Handler) http.Handler + func AllowAllCorsMW() *CorsMiddleware + func CorsMW(c *cors.Cors) *CorsMiddleware + func DefaultCorsMW() *CorsMiddleware + type Endpoint struct + CorsMiddleware *CorsMiddleware + Handler http.Handler + Method string + Middlewares []Middleware + Path string + SuppressLogs bool + SuppressMetrics bool + type Middleware func(http.Handler) http.Handler + func LogMW(logger *zap.SugaredLogger) Middleware + func MetricsMW(reg prometheus.Registerer, endpoints []Endpoint) Middleware + type Option func(*server) + func WithDefaultMiddleware(mw []Middleware) Option + func WithNotFoundHandler(h func(w http.ResponseWriter, r *http.Request)) Option + func WithPanicHandler(ph func(w http.ResponseWriter, r *http.Request, err interface{})) Option + type ProblemExtra func(*problem) + func WithDetail(d string) ProblemExtra + func WithFields(fields map[string]interface{}) ProblemExtra + func WithInstance(i string) ProblemExtra + func WithType(t string) ProblemExtra