Documentation
¶
Overview ¶
Package middleware implements some common gin middleware that can be shared between the API and a potential golang frontend. Includes panic recovery and request logging. Request logs contain both a raw duration (for machine parsing) and a human-readable pretty_duration field.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InsecureCORS ¶
func InsecureCORS() gin.HandlerFunc
InsecureCORS is a middleware that responds to option headers allowing all origins, methods, and headers. This should be replaces with a secure set up for production.
func Logging ¶
func Logging() gin.HandlerFunc
Logging is a middleware that tracks request information. It shows how long requests take, as well as some other information.
func Recovery ¶
func Recovery(includeStackTrace bool) gin.HandlerFunc
Recovery is the first middleware in the chain. It recovers from panics that happen in routes. There is a default one but it has ugly logging. Without this middleware, every panic in a route would crash the entire server.
Types ¶
This section is empty.