Documentation ¶
Index ¶
- Variables
- func CORS(config CORSConfig) pulse.Middleware
- func DefaultCORS() pulse.Middleware
- func DefaultLogging() pulse.Middleware
- func DefaultRecovery() pulse.Middleware
- func DefaultRequestID() pulse.Middleware
- func Logging(config LoggingConfig) pulse.Middleware
- func Recovery(config RecoveryConfig) pulse.Middleware
- func RequestID(config RequestIDConfig) pulse.Middleware
- type CORSConfig
- type LoggingConfig
- type RecoveryConfig
- type RequestIDConfig
Constants ¶
This section is empty.
Variables ¶
var DefaultCORSConfig = CORSConfig{ AllowOrigin: "*", AllowMethods: []string{"GET", "POST", "PUT", "DELETE"}, AllowHeaders: []string{"Content-Type", "Authorization"}, }
DefaultCORSConfig provides a default configuration for CORS.
var DefaultLoggingConfig = LoggingConfig{ Enabled: true, }
DefaultLoggingConfig provides a default configuration for Logging.
var DefaultRecoveryConfig = RecoveryConfig{ Enabled: true, }
DefaultRecoveryConfig provides a default configuration for Recovery.
var DefaultRequestIDConfig = RequestIDConfig{ Enabled: true, Header: "X-Request-ID", }
DefaultRequestIDConfig provides a default configuration for RequestID.
Functions ¶
func CORS ¶
func CORS(config CORSConfig) pulse.Middleware
CORS is a middleware function that handles Cross-Origin Resource Sharing (CORS) settings.
func DefaultCORS ¶
func DefaultCORS() pulse.Middleware
DefaultCORS is a middleware function that uses the default CORS settings.
func DefaultLogging ¶
func DefaultLogging() pulse.Middleware
DefaultLogging is a middleware function that uses the default Logging settings.
func DefaultRecovery ¶
func DefaultRecovery() pulse.Middleware
DefaultRecovery is a middleware function that uses the default Recovery settings.
func DefaultRequestID ¶
func DefaultRequestID() pulse.Middleware
DefaultRequestID is a middleware function that uses the default RequestID settings.
func Logging ¶
func Logging(config LoggingConfig) pulse.Middleware
Logging is a middleware function that logs the request details and execution time.
func Recovery ¶
func Recovery(config RecoveryConfig) pulse.Middleware
Recovery is a middleware function that handles panics and ensures the server does not crash.
func RequestID ¶
func RequestID(config RequestIDConfig) pulse.Middleware
RequestID is a middleware function that assigns a unique ID to each request for tracking and logging purposes.
Types ¶
type CORSConfig ¶
type CORSConfig struct { AllowOrigin string // Allowed origin for CORS AllowMethods []string // Allowed HTTP methods for CORS AllowHeaders []string // Allowed headers for CORS }
CORSConfig defines the configuration for the CORS middleware.
type LoggingConfig ¶
type LoggingConfig struct {
Enabled bool // Flag to enable or disable logging
}
LoggingConfig defines the configuration for the Logging middleware.
type RecoveryConfig ¶
type RecoveryConfig struct {
Enabled bool // Flag to enable or disable recovery
}
RecoveryConfig defines the configuration for the Recovery middleware.
type RequestIDConfig ¶
type RequestIDConfig struct { Enabled bool // Flag to enable or disable request ID generation Header string // Header name to store the request ID }
RequestIDConfig defines the configuration for the RequestID middleware.