Files
manifesti/app/main.py

30 lines
612 B
Python

from fastapi import FastAPI
from fastapi.responses import JSONResponse
app = FastAPI()
_healthy = True
@app.get("/")
def root():
return {"message": "Pozdrav svijete"}
# 🔥 HEALTH CHECK (BITNO: HTTP STATUS se mijenja)
@app.get("/health")
def health():
if not _healthy:
return JSONResponse(
status_code=500,
content={"status": "unhealthy"}
)
return {"status": "ok"}
# 🔥 BREAK ENDPOINT (simulira kvar)
@app.post("/break")
def break_health():
global _healthy
_healthy = False
return {"message": "Servis je sada nezdrav — ocekuj restart"}