middleware

package
v0.0.0-...-a1990c1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger(next http.Handler) http.Handler

Logger is a middleware that logs incoming requests and logging some of the details to slog.

Types

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

Metrics is a statefull middleware that records metrics. Must be created with NewMetricsMiddleware function.

func NewMetricsMiddleware

func NewMetricsMiddleware(registry metrics.HTTPMetricsRegistry) *Metrics

NewMetricsMiddleware returns a new Metrics middleware.

func (*Metrics) Handle

func (m *Metrics) Handle(next http.Handler) http.Handler

Handle is a middleware that records metrics.

type Middleware

type Middleware func(http.Handler) http.Handler

Middleware is a function that takes an http.Handler and returns an http.Handler.

func MakeChain

func MakeChain(mws ...Middleware) Middleware

MakeChain wraps a list of middlewares in a chain. Chain works like FIFO stack of middlewares.

Jump to

Keyboard shortcuts

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