Files
zadaca/app/main.py
ITO Mac d9253a952f .
2026-05-04 20:20:39 +02:00

24 lines
518 B
Python

import os
from fastapi import FastAPI, Response, status
from fastapi.responses import JSONResponse
app = FastAPI()
_healthy = True
@app.get("/health")
async def health():
if not _healthy:
return JSONResponse(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
content={"status": "unhealthy"}
)
return {"status": "ok"}
@app.post("/break")
def break_health():
global _healthy
_healthy = False
return {"message": "Servis je sada nezdrav — ocekuj restart"}