Skip to content

Commit

Permalink
health endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
muraty committed Oct 1, 2020
1 parent c58b369 commit 99d2480
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package server

import (
"context"
"fmt"
"kimo/config"
"net/http"
"time"
Expand Down Expand Up @@ -40,9 +41,15 @@ func (s *Server) Processes(w http.ResponseWriter, req *http.Request) {

}

func (s *Server) Health(w http.ResponseWriter, req *http.Request) {
// todo: real health check
fmt.Fprintf(w, "OK")
}

func (s *Server) Run() error {
log.Infof("Running server on %s \n", s.Config.ListenAddress)
http.HandleFunc("/procs", s.Processes)
http.HandleFunc("/health", s.Health)
err := http.ListenAndServe(s.Config.ListenAddress, nil)
if err != nil {
log.Errorln(err.Error())
Expand Down

0 comments on commit 99d2480

Please sign in to comment.