Documentation ¶
Index ¶
- Constants
- func AttachGzipCompress(ginEngine *gin.Engine) *gin.Engine
- func CORS() gin.HandlerFunc
- func DisableCache() gin.HandlerFunc
- func Metrics() gin.HandlerFunc
- func Recover() gin.HandlerFunc
- func RequestID(key string) gin.HandlerFunc
- func Secure() gin.HandlerFunc
- func TokenAuthMiddleware(ignorePaths []string, secret []byte) gin.HandlerFunc
- type Middleware
- func (m *Middleware) WithAuth(ignorePaths []string, secret []byte) *Middleware
- func (m *Middleware) WithCORS() *Middleware
- func (m *Middleware) WithCacheDisabled() *Middleware
- func (m *Middleware) WithCompress() *Middleware
- func (m *Middleware) WithMetrics() *Middleware
- func (m *Middleware) WithRecover() *Middleware
- func (m *Middleware) WithRequestID(key string) *Middleware
- func (m *Middleware) WithSecurity() *Middleware
Constants ¶
const SEP = ", "
Variables ¶
This section is empty.
Functions ¶
func DisableCache ¶
func DisableCache() gin.HandlerFunc
DisableCache is a middleware function that appends headers to prevent the client from caching the HTTP response.
func Metrics ¶ added in v0.1.4
func Metrics() gin.HandlerFunc
Metrics is a middleware function that enables metrics
func Recover ¶
func Recover() gin.HandlerFunc
func RequestID ¶
func RequestID(key string) gin.HandlerFunc
func Secure ¶
func Secure() gin.HandlerFunc
Secure is a middleware function that appends security and resource access headers
func TokenAuthMiddleware ¶ added in v0.1.5
func TokenAuthMiddleware(ignorePaths []string, secret []byte) gin.HandlerFunc
TokenAuthMiddleware is a middleware function that checks for a valid token in the Authorization header
Types ¶
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
func AttachTo ¶
func AttachTo(ginEngine *gin.Engine) *Middleware
func (*Middleware) WithAuth ¶ added in v0.1.5
func (m *Middleware) WithAuth(ignorePaths []string, secret []byte) *Middleware
WithAuth is a middleware function that checks for a valid token in the Authorization header ignorePaths: paths that do not need to check token,prefix match
func (*Middleware) WithCORS ¶
func (m *Middleware) WithCORS() *Middleware
WithCORS is a middleware function that allow CORS
func (*Middleware) WithCacheDisabled ¶
func (m *Middleware) WithCacheDisabled() *Middleware
WithCacheDisabled is a middleware function that sets cache headers
func (*Middleware) WithCompress ¶
func (m *Middleware) WithCompress() *Middleware
WithCompress is a middleware function that compresses the response
func (*Middleware) WithMetrics ¶ added in v0.1.4
func (m *Middleware) WithMetrics() *Middleware
WithMetrics is a middleware function that enables metrics
func (*Middleware) WithRecover ¶
func (m *Middleware) WithRecover() *Middleware
WithRecover is a middleware function that recovers from any panics and writes a 500 if there was one
func (*Middleware) WithRequestID ¶
func (m *Middleware) WithRequestID(key string) *Middleware
WithRequestID is a middleware function that sets a request ID
func (*Middleware) WithSecurity ¶
func (m *Middleware) WithSecurity() *Middleware
WithSecurity is a middleware function that enhance security