middleware

package
v0.0.0-...-cadcef1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthF

func AuthF(next func(http.ResponseWriter, *http.Request)) http.Handler

AuthF is a middleware that checks if the user is logged in by validating the token provided in the Authorization header

func AuthH

func AuthH(next http.Handler) http.Handler

AuthH is a middleware that checks if the user is logged in by validating the token provided in the Authorization header

func BodyF

func BodyF(bodyStruct interface{}) func(func(http.ResponseWriter, *http.Request)) http.Handler

BodyF is a middleware that takes a struct and a controller function. It parses the request body into the given struct and pushes it into the request's context using the BodyCtxKey

func BodyH

func BodyH(bodyStruct interface{}) func(http.Handler) http.Handler

BodyH is a middleware that takes a struct and a request handler. It parses the request body into the given struct and pushes it into the request's context using the BodyCtxKey

func CORS

func CORS(h http.Handler) http.Handler

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

func ParamsF

func ParamsF(next func(http.ResponseWriter, *http.Request)) http.Handler

ParamsF is a middleware that takes a controller function and pushes the request path parameters into the request's context using the ParamsCtxKey.

func ParamsH

func ParamsH(next http.Handler) http.Handler

ParamsH is a middleware that takes a request handler and pushes the request path parameters it into the request's context using the ParamsCtxKey.

func Recover

func Recover(h http.Handler) http.Handler

Recover is a middleware that recovers from panics and sends a 500 response.

Types

This section is empty.

Jump to

Keyboard shortcuts

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