Files
manifesti/app/main.py
2026-05-01 11:48:04 +02:00

24 lines
434 B
Python

from fastapi import FastAPI
from fastapi.responses import JSONResponse
app = FastAPI()
_healthy = True
@app.get("/")
def root():
return {"message": "Pozdrav svijete"}
@app.get("/health")
def health():
if not _healthy:
return {"status": "unhealthy"}, 503
return {"status": "ok"}
@app.post("/break")
def break_health():
global _healthy
_healthy = False
return {"message": "Servis je sada nezdrav"}