Skip to content

Commit

Permalink
Add health check endpoint (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
hawarir authored and fahrinh committed Aug 16, 2019
1 parent aabb9a8 commit b071d4e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ func NewServer(config config.Config) (*Server, error) {
func (s *Server) Run() error {
serveMux := http.NewServeMux()
serveMux.HandleFunc("/", s.ServeHTTP)
serveMux.HandleFunc("/application/health", http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
w.WriteHeader(http.StatusOK)
if _, err := w.Write([]byte("OK")); err != nil {
log.Printf("Failed to write health check body")
}
}))

address := fmt.Sprintf("%s:%s", s.config.Server.Host, s.config.Server.Port)
server := &http.Server{
Expand Down

0 comments on commit b071d4e

Please sign in to comment.