feat: add initial health-check application

This commit is contained in:
Mikhail Lobanov
2026-10-14 01:22:01 +03:00
commit 1e11f8244f
3 changed files with 73 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
import json
from http.server import BaseHTTPRequestHandler, HTTPServer
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == "/health":
status = 200
body = {"status": "ok"}
elif self.path == "/":
status = 200
body = {
"application": "devops-platform",
"version": "1.0.0"
}
else:
status = 404
body = {"error": "not found"}
payload = json.dumps(body).encode("utf-8")
self.send_response(status)
self.send_header("Content-Type", "application/json")
self.send_header("Content-Length", str(len(payload)))
self.end_headers()
self.wfile.write(payload)
def log_message(self, format, *args):
print(f"{self.client_address[0]} - {format % args}")
if __name__ == "__main__":
server = HTTPServer(("127.0.0.1", 8000), Handler)
print("Listening on http://127.0.0.1:8000")
server.serve_forever()