gin
5/14/25Less than 1 minutecomponentginmiddleware
Basic Configuration
In the YAML configuration files located in the configs
directory, you can configure HTTP service parameters via the http
field:
http:
port: 8080 # Service listening port number
timeout: 0 # Request timeout duration (seconds). Set to 0 to disable timeout control.
Reference Implementation: Gin Server Component Usage Example
Built-in gin Middleware
Services created by sponge come pre-integrated with the following common middleware (implementation code is in internal/routers/routers.go
). You can choose to use them as needed (some interceptor configurations can be adjusted via the YAML configuration files in the configs
directory).
Category | Feature List |
---|---|
Basic Functions | Logging, Request ID, Timeout, Recovery |
Security & Auth | JWT Authentication, CORS Support |
Flow Control | Adaptive Rate Limiting, Adaptive Circuit Breaking |
Observability | Tracing, Metrics Collection |
Click to view gin Middleware Usage Example.