diff --git a/app/main.py b/app/main.py index 866c7c2..aaee55d 100644 --- a/app/main.py +++ b/app/main.py @@ -2,10 +2,23 @@ from fastapi import FastAPI app = FastAPI() +_healthy = True # DODANO + + @app.get("/") def root(): return {"message": "Pozdrav svijete"} + @app.get("/health") def health(): - return {"status": "ok"} \ No newline at end of file + if not _healthy: # DODANO + return {"status": "unhealthy"} + return {"status": "ok"} + + +@app.post("/break") # DODANO +def break_health(): + global _healthy + _healthy = False + return {"message": "Servis je sada nezdrav — ocekuj restart"} \ No newline at end of file