Help us shape the future of Go! Take the 2026 Go Developer Survey

httpserver

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORS

func CORS(allowedOrigins []string, next http.Handler) http.Handler

func CorrelationID

func CorrelationID(next http.Handler) http.Handler

func CorrelationIDFromContext

func CorrelationIDFromContext(ctx context.Context) string

func ErrorPersistence

func ErrorPersistence(logger *slog.Logger, store errstore.Store, next http.Handler) http.Handler

func OnlyMethods

func OnlyMethods(methods ...string) func(http.Handler) http.Handler

func Recovery

func Recovery(logger *slog.Logger, next http.Handler) http.Handler

func RequestLogger

func RequestLogger(logger *slog.Logger, next http.Handler) http.Handler

func SecurityHeaders

func SecurityHeaders(next http.Handler) http.Handler

func WriteError

func WriteError(w http.ResponseWriter, r *http.Request, status int, code, message string)

func WriteJSON

func WriteJSON(w http.ResponseWriter, status int, payload any)

Types

type Server

type Server struct {
	HTTP *http.Server
	Mux  *http.ServeMux
}

func NewServer

func NewServer(cfg config.Config, logger *slog.Logger, store errstore.Store) *Server

Jump to

Keyboard shortcuts

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