aboutsummaryrefslogtreecommitdiff
path: root/internal/api/health.go
diff options
context:
space:
mode:
authorRanXom <saiyedshizain@gmail.com>2026-07-13 15:12:51 +0530
committerRanXom <saiyedshizain@gmail.com>2026-07-13 15:12:51 +0530
commit735e7310c904abf18293456d37044dd9c5e796b0 (patch)
tree19860e175604a1dbf3da5fe57f4db74161842dae /internal/api/health.go
parentcbad596b7825550b2e9cb1d6322f50acd7f1c9a7 (diff)
downloadgalleryd-735e7310c904abf18293456d37044dd9c5e796b0.tar.xz
galleryd-735e7310c904abf18293456d37044dd9c5e796b0.zip
feat(api): create a /health API endpoint
Diffstat (limited to 'internal/api/health.go')
-rw-r--r--internal/api/health.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/internal/api/health.go b/internal/api/health.go
new file mode 100644
index 0000000..61d5185
--- /dev/null
+++ b/internal/api/health.go
@@ -0,0 +1,29 @@
+package api
+
+import (
+ "encoding/json"
+ "net/http"
+)
+
+type HealthResponse struct {
+ Status string `json:"status"`
+}
+
+func (s *Server) handleHealth(
+ w http.ResponseWriter,
+ r *http.Request,
+) {
+ w.Header().Set("Content-Type", "application/json")
+
+ response := HealthResponse{
+ Status: "ok",
+ }
+
+ if err := json.NewEncoder(w).Encode(response); err != nil {
+ http.Error(
+ w,
+ http.StatusText(http.StatusInternalServerError),
+ http.StatusInternalServerError,
+ )
+ }
+}