middleware

package
v0.6.2-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2025 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggingMiddleware

func LoggingMiddleware(next http.Handler) http.Handler

LoggingMiddleware logs the details of each API request and response.

func RecoverMiddleware

func RecoverMiddleware(next http.Handler) http.Handler

RecoverMiddleware is an HTTP middleware that recovers from panics and returns 500 Internal Server Error.

Types

type CorsOptions

type CorsOptions struct {
	AllowedOrigin  string
	AllowedMethods []string
	AllowedHeaders []string
}

func (CorsOptions) Validate

func (o CorsOptions) Validate() bool

type Middleware

type Middleware func(http.Handler) http.Handler

func AllowCors

func AllowCors(options CorsOptions) Middleware

AllowCORS returns a middleware that sets the CORS headers.

Jump to

Keyboard shortcuts

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