diff --git a/backend/app.py b/backend/app.py index 8bf6059..556a25e 100644 --- a/backend/app.py +++ b/backend/app.py @@ -105,6 +105,20 @@ def delete_task(task_id): return jsonify({"result": "ok"}) +@app.route("/api/health", methods=["GET"]) +def health(): + try: + conn = get_db() + cur = conn.cursor() + cur.execute("SELECT 1") + cur.fetchone() + cur.close() + conn.close() + return jsonify({"status": "ok"}), 200 + except Exception as exc: + return jsonify({"status": "unhealthy", "error": str(exc)}), 503 + + if __name__ == "__main__": init_db() app.run(host="0.0.0.0", port=5000)