first commit
This commit is contained in:
19
backend/app/api/routes/health.py
Normal file
19
backend/app/api/routes/health.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlalchemy import text
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.api.deps import get_db
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/health")
|
||||
def health(db: Session = Depends(get_db)):
|
||||
status = "ok"
|
||||
try:
|
||||
db.execute(text("SELECT 1"))
|
||||
except Exception:
|
||||
status = "error"
|
||||
return {"status": status, "timestamp": datetime.now(timezone.utc).isoformat()}
|
||||
Reference in New Issue
Block a user