5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-26 05:31:34 +00:00

Add a health endpoint to API (#554)

This commit is contained in:
Patrick Connolly 2018-11-07 16:11:59 +08:00 committed by Wim
parent 5132d8f097
commit 5666821e7b

View File

@ -41,6 +41,7 @@ func New(cfg *bridge.Config) bridge.Bridger {
return key == b.GetString("Token"), nil return key == b.GetString("Token"), nil
})) }))
} }
e.GET("/api/health", b.handleHealthcheck)
e.GET("/api/messages", b.handleMessages) e.GET("/api/messages", b.handleMessages)
e.GET("/api/stream", b.handleStream) e.GET("/api/stream", b.handleStream)
e.POST("/api/message", b.handlePostMessage) e.POST("/api/message", b.handlePostMessage)
@ -77,6 +78,10 @@ func (b *Api) Send(msg config.Message) (string, error) {
return "", nil return "", nil
} }
func (b *Api) handleHealthcheck(c echo.Context) error {
return c.String(http.StatusOK, "OK")
}
func (b *Api) handlePostMessage(c echo.Context) error { func (b *Api) handlePostMessage(c echo.Context) error {
message := config.Message{} message := config.Message{}
if err := c.Bind(&message); err != nil { if err := c.Bind(&message); err != nil {