Versions in this module Expand all Collapse all v0 v0.1.0 Mar 23, 2026 Changes in this version + func HealthHandler(checkers ...ReadinessChecker) http.Handler + func RequestIDFromContext(ctx context.Context) string + func WriteError(w http.ResponseWriter, status int, msg string) error + func WriteJSON(w http.ResponseWriter, status int, v any) error + type CORSOption func(*corsOptions) + func AllowCredentials(allow bool) CORSOption + func AllowHeaders(headers ...string) CORSOption + func AllowMethods(methods ...string) CORSOption + func AllowOrigins(origins ...string) CORSOption + func ExposeHeaders(headers ...string) CORSOption + func MaxAge(seconds int) CORSOption + type Middleware func(http.Handler) http.Handler + func CORS(opts ...CORSOption) Middleware + func Chain(mws ...Middleware) Middleware + func Logging(logger *slog.Logger) Middleware + func MaxBodySize(n int64) Middleware + func RateLimit(opts ...RateLimitOption) Middleware + func Recovery(opts ...RecoveryOption) Middleware + func RequestID() Middleware + func Timeout(d time.Duration) Middleware + type Option func(*serverOptions) + func Defaults(logger *slog.Logger) []Option + func WithAddr(addr string) Option + func WithIdleTimeout(d time.Duration) Option + func WithLogger(l *slog.Logger) Option + func WithMiddleware(mws ...Middleware) Option + func WithOnShutdown(fn func()) Option + func WithReadHeaderTimeout(d time.Duration) Option + func WithReadTimeout(d time.Duration) Option + func WithShutdownTimeout(d time.Duration) Option + func WithWriteTimeout(d time.Duration) Option + type RateLimitOption func(*rateLimitOptions) + func WithBurst(n int) RateLimitOption + func WithKeyFunc(fn func(r *http.Request) string) RateLimitOption + func WithRate(tokensPerSecond float64) RateLimitOption + type ReadinessChecker func() error + type RecoveryOption func(*recoveryOptions) + func WithRecoveryLogger(l *slog.Logger) RecoveryOption + type Router struct + func NewRouter(opts ...RouterOption) *Router + func (r *Router) Group(prefix string, mws ...Middleware) *Router + func (r *Router) Handle(pattern string, handler http.Handler) + func (r *Router) HandleFunc(pattern string, fn http.HandlerFunc) + func (r *Router) Mount(prefix string, handler http.Handler) + func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) + type RouterOption func(*Router) + func WithNotFoundHandler(h http.Handler) RouterOption + type Server struct + func New(handler http.Handler, opts ...Option) *Server + func (s *Server) Addr() string + func (s *Server) ListenAndServe() error + func (s *Server) ListenAndServeTLS(certFile, keyFile string) error + func (s *Server) Shutdown(ctx context.Context) error