14 lines
329 B
Python
14 lines
329 B
Python
from fastapi import APIRouter
|
|
from sqlalchemy import text
|
|
from app.db.session import SessionLocal
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get("/health/db")
|
|
def db_health():
|
|
db = SessionLocal()
|
|
try:
|
|
result = db.execute(text("SELECT 1")).scalar()
|
|
return {"status": "ok", "db": result}
|
|
finally:
|
|
db.close() |