http_server

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

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)

func (*HTTPServer) Start

func (s *HTTPServer) Start() error

Start starts the HTTP server

func (*HTTPServer) Stop

func (s *HTTPServer) Stop(ctx context.Context) error

Stop gracefully shuts down the server with context timeout

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL