Automated Action e1b1b89511 Create FastAPI REST API with SQLite
Features:
- Project structure with FastAPI framework
- SQLAlchemy models with SQLite database
- Alembic migrations system
- CRUD operations for items
- API routers with endpoints for items
- Health endpoint for monitoring
- Error handling and validation
- Comprehensive documentation
2025-05-18 05:45:33 +00:00

16 lines
431 B
Python

from fastapi import APIRouter, Depends
from sqlalchemy.orm import Session
from app.db.session import get_db
router = APIRouter()
@router.get("", status_code=200)
def health_check(db: Session = Depends(get_db)):
"""
Health check endpoint to verify API is running and database connection is working.
"""
health_status = {"status": "ok", "database": "connected" if db else "disconnected"}
return health_status