Documentation
¶
Index ¶
- Constants
- func ErrorResponse(w http.ResponseWriter, status int, message string, err error)
- func JSONResponse(w http.ResponseWriter, status int, message string, data any)
- func ParseBody(r *http.Request, target any) error
- type CORSMiddleware
- type ErrorResponseStruct
- type GlobalJWTMiddleware
- type GlobalResponse
- type GraceFulShutDown
- type JWTManager
Constants ¶
View Source
const ( ORIGIN_CONTROL = "Access-Control-Allow-Origin" METHOD_CONTROL = "Access-Control-Allow-Methods" HEADER_CONTROL = "Access-Control-Allow-Headers" CREDENTIALS_CONTROL = "Access-Control-Allow-Credentials" )
Variables ¶
This section is empty.
Functions ¶
func ErrorResponse ¶
func ErrorResponse(w http.ResponseWriter, status int, message string, err error)
func JSONResponse ¶
func JSONResponse(w http.ResponseWriter, status int, message string, data any)
Types ¶
type CORSMiddleware ¶
type CORSMiddleware struct { AllowedOrigins []string AllowedMethods []string AllowedHeaders []string AllowCredentials bool }
func NewCORSMiddleware ¶
func NewCORSMiddleware() *CORSMiddleware
func (*CORSMiddleware) AllowHeaders ¶
func (c *CORSMiddleware) AllowHeaders(headers []string) *CORSMiddleware
func (*CORSMiddleware) AllowMethods ¶
func (c *CORSMiddleware) AllowMethods(methods []string) *CORSMiddleware
func (*CORSMiddleware) AllowOrigins ¶
func (c *CORSMiddleware) AllowOrigins(origins []string) *CORSMiddleware
type ErrorResponseStruct ¶
type GlobalJWTMiddleware ¶
type GlobalJWTMiddleware struct {
Secret string
}
func NewJWTMiddleware ¶
func NewJWTMiddleware(secretKey string) *GlobalJWTMiddleware
func (*GlobalJWTMiddleware) Authorize ¶
func (j *GlobalJWTMiddleware) Authorize(next http.Handler) http.Handler
func (*GlobalJWTMiddleware) FastAuthorize ¶ added in v1.2.2
func (j *GlobalJWTMiddleware) FastAuthorize(next fasthttp.RequestHandler) fasthttp.RequestHandler
func (*GlobalJWTMiddleware) FiberAuthorize ¶ added in v1.2.5
func (j *GlobalJWTMiddleware) FiberAuthorize() fiber.Handler
type GlobalResponse ¶
type GraceFulShutDown ¶
type GraceFulShutDown struct {
// contains filtered or unexported fields
}
func New ¶
func New() *GraceFulShutDown
func (*GraceFulShutDown) AddTask ¶
func (g *GraceFulShutDown) AddTask(task func(ctx context.Context) error)
func (*GraceFulShutDown) Run ¶
func (g *GraceFulShutDown) Run(timeout time.Duration)
type JWTManager ¶
func NewJWTManager ¶
func NewJWTManager(secretKey string, duration time.Duration) *JWTManager
func (*JWTManager) GenerateToken ¶
Click to show internal directories.
Click to hide internal directories.