Documentation
¶
Overview ¶
Package middlewares contains Gin HTTP middlewares used by the restapi server (CORS, logging, no-cache).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CORSMiddleware ¶
func CORSMiddleware() gin.HandlerFunc
CORSMiddleware sets Cross-Origin Resource Sharing (CORS) headers to allow requests across origins. Handles preflight requests by responding with status 200 for OPTIONS method. Configures allowed origins, methods, headers, credentials, and max age for caching.
func NoCache ¶
func NoCache() gin.HandlerFunc
NoCache is a middleware function that sets headers to prevent HTTP response caching and removes ETag-related request headers.
func RequestLogger ¶
func RequestLogger() gin.HandlerFunc
RequestLogger is a middleware for logging details of HTTP requests, including method, path, status, content length, referrer, user agent, and request body if applicable, excluding GET requests. It ensures detailed request monitoring and is designed for use with the Gin framework.
Types ¶
This section is empty.