diff --git a/internal/server/server.go b/internal/server/server.go index f75f6c37..83233549 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -32,6 +32,7 @@ func NewServer(builder chain.TxBuilder, cfg *Config) *Server { func (s *Server) setupRouter() *http.ServeMux { router := http.NewServeMux() router.Handle("/", http.FileServer(web.Dist())) + router.Handle("/health", s.handleHealthCheck()) limiter := NewLimiter(s.cfg.proxyCount, time.Duration(s.cfg.interval)*time.Minute) hcaptcha := NewCaptcha(s.cfg.hcaptchaSiteKey, s.cfg.hcaptchaSecret) router.Handle("/api/claim", negroni.New(limiter, hcaptcha, negroni.Wrap(s.handleClaim()))) @@ -95,3 +96,10 @@ func (s *Server) handleInfo() http.HandlerFunc { }, http.StatusOK) } } + +func (s *Server) handleHealthCheck() http.HandlerFunc { + return func(w http.ResponseWriter, _ *http.Request) { + //nolint:errcheck + w.Write([]byte("OK")) + } +}