diff --git a/api_handler.go b/api_handler.go index d667e460..d946b2a1 100644 --- a/api_handler.go +++ b/api_handler.go @@ -30,6 +30,10 @@ type apiHandler struct { queries *db.Queries } +func (a *apiHandler) Healthcheck(rw http.ResponseWriter, req *http.Request) { + a.writeResponse(req.Context(), rw, []byte("{\"status\": \"ok\"}")) +} + func (a *apiHandler) JobCancel(rw http.ResponseWriter, req *http.Request) { ctx, cancel := context.WithTimeout(req.Context(), 5*time.Second) defer cancel() diff --git a/handler.go b/handler.go index 15fd7ca8..d69c785a 100644 --- a/handler.go +++ b/handler.go @@ -92,6 +92,7 @@ func NewHandler(opts *HandlerOpts) (http.Handler, error) { mux.HandleFunc("GET /api/workflows/{id}", handler.WorkflowGet) mux.HandleFunc("GET /api/states", handler.StatesAndCounts) mux.HandleFunc("/api", http.NotFound) + mux.HandleFunc("GET /healthcheck", handler.Healthcheck) mux.Handle("/", intercept404(fileServer, serveIndex)) if prefix != "/" {