rest

package
v0.0.1-dev.12 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Middleware

type Middleware func(http.Handler) http.Handler

Middleware is a function that wraps an http.Handler.

func APIKey

func APIKey(apiKeys []string, logger log.Logger) Middleware

APIKey returns a middleware that checks for a valid API key.

func CORS

func CORS() Middleware

CORS returns a middleware that adds CORS headers to the response.

func Chain

func Chain(middlewares ...Middleware) Middleware

Chain combines multiple middleware into a single middleware.

func Logger

func Logger(logger log.Logger) Middleware

Logger returns a middleware that logs HTTP requests.

func Recovery

func Recovery(logger log.Logger) Middleware

Recovery returns a middleware that recovers from panics.

func Timeout

func Timeout(timeout time.Duration) Middleware

Timeout returns a middleware that adds a timeout to the request context.

Jump to

Keyboard shortcuts

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