Documentation
¶
Overview ¶
Package http provides HTTP server implementation and request handlers.
Package http provides HTTP server implementation and request handlers using Gin web framework. The server uses Clean Architecture principles with structured logging (slog) and graceful shutdown.
This server uses Gin (github.com/gin-gonic/gin) for HTTP routing while maintaining compatibility with the application's existing patterns:
- Custom slog-based logging middleware (instead of Gin's default logger)
- Gin-compatible error handling utilities (httputil.HandleErrorGin)
- Manual http.Server configuration for timeout and graceful shutdown control
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CustomLoggerMiddleware ¶
func CustomLoggerMiddleware(logger *slog.Logger) gin.HandlerFunc
CustomLoggerMiddleware provides structured logging using slog. This replaces Gin's default logger to maintain consistency with the application's existing logging patterns.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the HTTP server.
func (*Server) GetHandler ¶
GetHandler returns the http.Handler for testing purposes. Returns nil if SetupRouter has not been called yet.
func (*Server) SetupRouter ¶
func (s *Server) SetupRouter( clientHandler *authHTTP.ClientHandler, tokenHandler *authHTTP.TokenHandler, auditLogHandler *authHTTP.AuditLogHandler, secretHandler *secretsHTTP.SecretHandler, transitKeyHandler *transitHTTP.TransitKeyHandler, cryptoHandler *transitHTTP.CryptoHandler, tokenUseCase authUseCase.TokenUseCase, tokenService authService.TokenService, auditLogUseCase authUseCase.AuditLogUseCase, metricsProvider *metrics.Provider, metricsNamespace string, )
SetupRouter configures the Gin router with all routes and middleware. This method is called during server initialization with all required dependencies.