diff options
| author | Patrick Spek <p.spek@tyil.nl> | 2025-12-10 09:21:15 +0100 |
|---|---|---|
| committer | Patrick Spek <p.spek@tyil.nl> | 2025-12-10 09:21:15 +0100 |
| commit | d07bdf82d8edc1fe7877e452592528bdf67fc533 (patch) | |
| tree | be80a68594f373db6b310819efd12b6ed9ddac4c | |
| parent | 9d8c2130d9a6f18cfb6ce999d9f188aff79d5a47 (diff) | |
| download | dashlab-d07bdf82d8edc1fe7877e452592528bdf67fc533.tar.gz dashlab-d07bdf82d8edc1fe7877e452592528bdf67fc533.tar.bz2 | |
Include simple HTTP healthcheck endpoint
| -rw-r--r-- | handlers/health.go | 25 | ||||
| -rw-r--r-- | main.go | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/handlers/health.go b/handlers/health.go new file mode 100644 index 0000000..d09183d --- /dev/null +++ b/handlers/health.go @@ -0,0 +1,25 @@ +// Copyright (C) 2025 Patrick "tyil" Spek <p.spek@tyil.nl> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see <https://www.gnu.org/licenses/>. + +package handlers + +import ( + "net/http" +) + +func Health(res http.ResponseWriter, req *http.Request) { + res.WriteHeader(http.StatusOK) + res.Write([]byte("")) +} @@ -51,6 +51,7 @@ func main() { mux.Handle("GET /icon/", http.StripPrefix("/icon", http.FileServer(http.Dir("./icon")))) mux.Handle("GET /style.css", middleware.thenFunc(handlers.Stylesheet)) mux.Handle("GET /whoami", middleware.thenFunc(handlers.WhoAmI)) + mux.Handle("GET /-/healthz", middleware.thenFunc(handlers.Health)) mux.Handle("GET /", middleware.thenFunc(handlers.Index)) // Start HTTP server |
