Documentation
¶
Index ¶
- type HTTPServer
- func (s *HTTPServer) Handle(pattern string, handler http.Handler)
- func (s *HTTPServer) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
- func (s *HTTPServer) HandleFuncWithMiddleware(pattern string, handler func(http.ResponseWriter, *http.Request), ...)
- func (s *HTTPServer) HandleWithMiddleware(pattern string, handler http.Handler, middlewares ...middleware.Middleware)
- func (s *HTTPServer) Start() error
- func (s *HTTPServer) Stop(ctx context.Context) error
- type HTTPServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
func (*HTTPServer) Handle ¶
func (s *HTTPServer) Handle(pattern string, handler http.Handler)
Handle implements the Server interface for routing
func (*HTTPServer) HandleFunc ¶
func (s *HTTPServer) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
HandleFunc implements the Server interface for routing functions
func (*HTTPServer) HandleFuncWithMiddleware ¶
func (s *HTTPServer) HandleFuncWithMiddleware(pattern string, handler func(http.ResponseWriter, *http.Request), middlewares ...middleware.Middleware)
HandleFuncWithMiddleware registers a handler function with specific middleware The middleware will be applied in order (first to last) Example: server.HandleFuncWithMiddleware("/api/version", versionHandler, loggingMiddleware)
func (*HTTPServer) HandleWithMiddleware ¶
func (s *HTTPServer) HandleWithMiddleware(pattern string, handler http.Handler, middlewares ...middleware.Middleware)
HandleWithMiddleware registers a handler with specific middleware The middleware will be applied in order (first to last) Example: server.HandleWithMiddleware("/api/users", handler, loggingMiddleware, authMiddleware)
type HTTPServerConfig ¶
type HTTPServerConfig struct {
Addr string
Port int
Timeout int
ReadTimeout int
WriteTimeout int
Log *slog.Logger
}
Server wraps the standard net/http server implementation
func (*HTTPServerConfig) New ¶
func (h *HTTPServerConfig) New() *HTTPServer
New creates a new HTTP server on the specified port