Documentation ¶
Index ¶
- Variables
- func GetTX(c echo.Context) newrelic.Transaction
- func HealthCheckHandler(app *App) func(c echo.Context) error
- func HistoryHandler(app *App) func(c echo.Context) error
- func HistorySinceHandler(app *App) func(c echo.Context) error
- func NotFoundHandler(app *App) func(c echo.Context) error
- func VersionMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- func WithSegment(name string, c echo.Context, f func() error) error
- type App
- type LoggerMiddleware
- type Message
- type NewRelicMiddleware
- type RecoveryMiddleware
- type SentryMiddleware
Constants ¶
This section is empty.
Variables ¶
var VERSION = "2.2.1"
VERSION is the current api version
Functions ¶
func HealthCheckHandler ¶
HealthCheckHandler is the handler responsible for validating that the app is still up
func HistoryHandler ¶
HistoryHandler is the handler responsible for sending the rooms history to the player
func HistorySinceHandler ¶
HistorySinceHandler is the handler responsible for sending the rooms history to the player based in a initial date
func NotFoundHandler ¶
NotFoundHandler is the handler responsible for responding when no resource was found
func VersionMiddleware ¶
func VersionMiddleware(next echo.HandlerFunc) echo.HandlerFunc
VersionMiddleware automatically adds a version header to response
Types ¶
type App ¶
type App struct { Debug bool Port int Host string API *echo.Echo Engine engine.Server MQTTBot *bot.MQTTBot RedisClient *redisclient.RedisClient NewRelic newrelic.Application }
App is the struct that defines the application
func (*App) OnErrorHandler ¶
OnErrorHandler handles application panics
type LoggerMiddleware ¶
LoggerMiddleware is responsible for logging to Zap all requests
func NewLoggerMiddleware ¶
func NewLoggerMiddleware(theLogger zap.Logger) *LoggerMiddleware
NewLoggerMiddleware returns the logger middleware
func (LoggerMiddleware) Serve ¶
func (l LoggerMiddleware) Serve(next echo.HandlerFunc) echo.HandlerFunc
Serve serves the middleware
type Message ¶
type Message struct { Timestamp time.Time `json:"timestamp"` Payload string `json:"payload"` Topic string `json:"topic"` }
Message represents a chat message
type NewRelicMiddleware ¶
NewRelicMiddleware is responsible for logging to Zap all requests
func NewNewRelicMiddleware ¶
func NewNewRelicMiddleware(app *App, theLogger zap.Logger) *NewRelicMiddleware
NewNewRelicMiddleware returns the logger middleware
func (*NewRelicMiddleware) Serve ¶
func (nr *NewRelicMiddleware) Serve(next echo.HandlerFunc) echo.HandlerFunc
Serve serves the middleware
type RecoveryMiddleware ¶
type RecoveryMiddleware struct {
OnError func(interface{}, []byte)
}
RecoveryMiddleware recovers from errors in Echo
func NewRecoveryMiddleware ¶
func NewRecoveryMiddleware(onError func(interface{}, []byte)) *RecoveryMiddleware
NewRecoveryMiddleware returns a configured middleware
func (RecoveryMiddleware) Serve ¶
func (r RecoveryMiddleware) Serve(next echo.HandlerFunc) echo.HandlerFunc
Serve executes on error handler when errors happen
type SentryMiddleware ¶
type SentryMiddleware struct {
App *App
}
SentryMiddleware is responsible for sending all exceptions to sentry
func NewSentryMiddleware ¶
func NewSentryMiddleware(app *App) *SentryMiddleware
NewSentryMiddleware returns a new sentry middleware
func (SentryMiddleware) Serve ¶
func (s SentryMiddleware) Serve(next echo.HandlerFunc) echo.HandlerFunc
Serve serves the middleware