Skip to content

Commit

Permalink
Add a health endpoint to API (42wim#554)
Browse files Browse the repository at this point in the history
  • Loading branch information
patcon authored and 42wim committed Nov 7, 2018
1 parent 5132d8f commit 5666821
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bridge/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func New(cfg *bridge.Config) bridge.Bridger {
return key == b.GetString("Token"), nil
}))
}
e.GET("/api/health", b.handleHealthcheck)
e.GET("/api/messages", b.handleMessages)
e.GET("/api/stream", b.handleStream)
e.POST("/api/message", b.handlePostMessage)
Expand Down Expand Up @@ -77,6 +78,10 @@ func (b *Api) Send(msg config.Message) (string, error) {
return "", nil
}

func (b *Api) handleHealthcheck(c echo.Context) error {
return c.String(http.StatusOK, "OK")
}

func (b *Api) handlePostMessage(c echo.Context) error {
message := config.Message{}
if err := c.Bind(&message); err != nil {
Expand Down

0 comments on commit 5666821

Please sign in to comment.