middleware

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2024 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORS

func CORS(options cors.Options) gin.HandlerFunc

CORS returns the cors handler

func CacheMemory

func CacheMemory(prefix string, ttl time.Duration) gin.HandlerFunc

CacheMemory returns the cache in memory handler

func CacheRedis

func CacheRedis(prefix string, ttl time.Duration, client *redis.Client) gin.HandlerFunc

CacheRedis returns the cache in redis handler

func Logger

func Logger(logger *slog.Logger, msg string) gin.HandlerFunc

Logger returns the access log handler

func NoMethod

func NoMethod(methods ...string) gin.HandlerFunc

NoMethod deals with case of method not allowed

func NoRoute

func NoRoute() gin.HandlerFunc

NoRoute deals with case of 404

func RateLimit

func RateLimit(limiter ratelimit.Limiter, errorHandler func(ctx *gin.Context, err error)) gin.HandlerFunc

RateLimit returns limiter handler

func Recovery

func Recovery(logger *slog.Logger, handler func(ctx *gin.Context, logger *slog.Logger, err any)) gin.HandlerFunc

Recovery returns the recovery handler

Types

This section is empty.

Jump to

Keyboard shortcuts

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