diff --git a/backend/src/app/http.clj b/backend/src/app/http.clj index d053786bb..594916a06 100644 --- a/backend/src/app/http.clj +++ b/backend/src/app/http.clj @@ -150,8 +150,8 @@ [middleware/errors errors/handle] [middleware/cookies]]} + ["/health" {:get (:health-check debug)}] ["/_doc" {:get (doc/handler rpc)}] - ["/feedback" {:middleware [(:middleware session)] :post feedback}] ["/auth/oauth/:provider" {:post (:handler oauth)}] diff --git a/backend/src/app/http/debug.clj b/backend/src/app/http/debug.clj index 8e021fcd8..e31040618 100644 --- a/backend/src/app/http/debug.clj +++ b/backend/src/app/http/debug.clj @@ -18,9 +18,9 @@ [app.util.template :as tmpl] [app.util.time :as dt] [clojure.java.io :as io] - [fipp.edn :as fpp] [cuerdas.core :as str] [datoteka.core :as fs] + [fipp.edn :as fpp] [integrant.core :as ig])) ;; (selmer.parser/cache-off!) @@ -194,9 +194,17 @@ :body (-> (io/resource "templates/error-list.tmpl") (tmpl/render {:items items}))})) +(defn health-check + "Mainly a task that performs a health check." + [{:keys [pool]} _] + (db/with-atomic [conn pool] + (db/exec-one! conn ["select count(*) as count from server_prop;"]) + {:status 200 :body "Ok"})) + (defmethod ig/init-key ::handlers [_ cfg] {:index (partial index cfg) + :health-check (partial health-check cfg) :retrieve-file-data (partial retrieve-file-data cfg) :retrieve-file-changes (partial retrieve-file-changes cfg) :retrieve-error (partial retrieve-error cfg)