Versions in this module Expand all Collapse all v0 v0.15.0 Jun 6, 2026 v0.14.0 Jun 6, 2026 v0.13.0 Jun 6, 2026 v0.12.0 Jun 6, 2026 Changes in this version + const CodeBadRequest + const CodeInternalError + const CodeMethodNotAllowed + const CodeNotFound + const CodeServiceUnavailable + const CodeSuccess + const CodeTooManyRequests + func GracefulShutdown(ctx context.Context, logger Logger, httpServer *http.Server, ...) error + type Config struct + CORSAllowedHeaders []string + CORSAllowedMethods []string + CORSAllowedOrigins []string + CORSMaxAge time.Duration + HealthPath string + IdleTimeout time.Duration + LogLevel string + LogSuccessReq bool + MaxHeaderBytes int + MiddlewareCORS bool + MiddlewareRecovery bool + MiddlewareRequestID bool + MiddlewareTimeout bool + MiddlewareValidation bool + ReadTimeout time.Duration + RequestTimeout time.Duration + ShutdownTimeout time.Duration + TLSCertFile string + TLSKeyFile string + WriteTimeout time.Duration + func (c *Config) Validate() error + type Field struct + Key string + Value any + func AnyField(key string, val any) Field + func DurationField(key string, val time.Duration) Field + func ErrorField(err error) Field + func IntField(key string, val int) Field + func StringField(key, val string) Field + type HandlerFunc = gin.HandlerFunc + type Logger interface + Debug func(ctx context.Context, msg string, fields ...Field) + Error func(ctx context.Context, msg string, fields ...Field) + Fatal func(ctx context.Context, msg string, fields ...Field) + Info func(ctx context.Context, msg string, fields ...Field) + Warn func(ctx context.Context, msg string, fields ...Field) + type MiddlewareType string + const MiddlewareCORS + const MiddlewareRateLimit + const MiddlewareRecovery + const MiddlewareRequestID + const MiddlewareTimeout + const MiddlewareValidation + type NoopLogger struct + func (n NoopLogger) Debug(_ context.Context, _ string, _ ...Field) + func (n NoopLogger) Error(_ context.Context, _ string, _ ...Field) + func (n NoopLogger) Fatal(_ context.Context, _ string, _ ...Field) + func (n NoopLogger) Info(_ context.Context, _ string, _ ...Field) + func (n NoopLogger) Warn(_ context.Context, _ string, _ ...Field) + type RateLimitOptions struct + CleanupInterval time.Duration + QPS int + Whitelist []string + Window time.Duration + type Route struct + Handler HandlerFunc + Method string + Middleware []HandlerFunc + Path string + type RouteGroup struct + func (rg *RouteGroup) DELETE(path string, handler HandlerFunc, mw ...HandlerFunc) + func (rg *RouteGroup) GET(path string, handler HandlerFunc, mw ...HandlerFunc) + func (rg *RouteGroup) Group(relativePath string) *RouteGroup + func (rg *RouteGroup) PATCH(path string, handler HandlerFunc, mw ...HandlerFunc) + func (rg *RouteGroup) POST(path string, handler HandlerFunc, mw ...HandlerFunc) + func (rg *RouteGroup) PUT(path string, handler HandlerFunc, mw ...HandlerFunc) + func (rg *RouteGroup) Use(middleware ...HandlerFunc) + type Server struct + func NewServer(cfg Config) *Server + func (s *Server) DisableMiddleware(mt ...MiddlewareType) *Server + func (s *Server) DisableRateLimit() *Server + func (s *Server) EnableMiddleware(mt ...MiddlewareType) *Server + func (s *Server) EnableRateLimit(opts RateLimitOptions) *Server + func (s *Server) EnableSPA(filesys http.FileSystem, indexPath string) *Server + func (s *Server) ListenerAddr() string + func (s *Server) OverrideMiddleware(mt MiddlewareType, mw HandlerFunc) *Server + func (s *Server) RegisterRoute(r Route) *Server + func (s *Server) RegisterRouteGroup(prefix string, fn func(*RouteGroup)) *Server + func (s *Server) RegisterRoutes(routes []Route) *Server + func (s *Server) ServeStaticDir(prefix, root string) *Server + func (s *Server) ServeStaticFS(prefix string, filesys http.FileSystem) *Server + func (s *Server) Start() error + func (s *Server) Stop(ctx context.Context) error + func (s *Server) UseGlobalMiddleware(mw ...HandlerFunc) *Server + func (s *Server) UseHttp2Listen(addr string) *Server + func (s *Server) UseHttp3Listen(addr string) *Server + func (s *Server) UseUnixSocketListen(path string, perm os.FileMode) *Server + func (s *Server) WithLogger(l Logger) *Server + type StandardizedResponse struct + Code int + Data any + Msg string + RequestID string + Timestamp int64