Documentation ¶
Index ¶
- func ContextMiddleware() gin.HandlerFunc
- func LoggingMiddleware() gin.HandlerFunc
- func RecoveryMiddlware(ctx *gin.Context, recovered interface{})
- func SetupRouter() *gin.Engine
- type Server
- func (s *Server) MiscV2BrewGet(c *gin.Context)
- func (s *Server) MiscV2HealthcheckGet(c *gin.Context)
- func (s *Server) MiscV2PingGet(c *gin.Context)
- func (s *Server) RootGet(c *gin.Context)
- func (s *Server) RootV2Get(c *gin.Context)
- func (s *Server) Start(ctx context.Context) error
- func (s *Server) Stop(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextMiddleware ¶
func ContextMiddleware() gin.HandlerFunc
* This middlware adds a context ID to the request so we can track all requests from this user through the logs
func LoggingMiddleware ¶
func LoggingMiddleware() gin.HandlerFunc
* This middleware logs primarily the request path, method, response status and completion latency
func RecoveryMiddlware ¶
* This middleware prints a panic to the log and responds to the user with an error
func SetupRouter ¶
Types ¶
type Server ¶
func (*Server) MiscV2BrewGet ¶
MiscV2BrewGet godoc @Summary Brew coffee @Description Responds with refusal to brew coffee @Tags V2 @Produce json @Success 200 {object} helpers.Error @Router /v2/brew [get]
func (*Server) MiscV2HealthcheckGet ¶
MiscV2HealthcheckGet godoc @Summary Get health of API @Description Responds with any service errors @Tags V2 @Produce json @Success 200 {object} helpers.Empty @Success 503 {object} helpers.ErrorsArray @Failure 500 {object} helpers.Error @Router /v2/healthcheck [get]
func (*Server) MiscV2PingGet ¶
MiscV2PingGet godoc @Summary Ping pong @Description Responds with a pong @Tags V2 @Produce json @Success 200 {object} helpers.Message @Router /v2/ping [get]
func (*Server) RootGet ¶
RootGet godoc @Summary Redirect to swagger docs @Description Redirect to swagger docs @Tags Root @Success 307 @Header 307 {string} Location "docs/index.html" @Router / [get]