Automated Action f8bb3dd21d Implement Task Management Tool with FastAPI and SQLite
- Set up FastAPI project structure with API versioning
- Create database models for users and tasks
- Implement SQLAlchemy ORM with SQLite database
- Initialize Alembic for database migrations
- Create API endpoints for task management (CRUD)
- Create API endpoints for user management
- Add JWT authentication and authorization
- Add health check endpoint
- Add comprehensive README.md with API documentation
2025-06-02 20:40:57 +00:00

25 lines
561 B
Python

from fastapi import APIRouter, Depends
from sqlalchemy import text
from sqlalchemy.orm import Session
from app.db.session import get_db
router = APIRouter()
@router.get("", status_code=200)
async def health_check(db: Session = Depends(get_db)):
"""
Health check endpoint to verify API is running correctly
"""
# Check database connection
try:
db.execute(text("SELECT 1"))
db_status = "healthy"
except Exception:
db_status = "unhealthy"
return {
"status": "ok",
"database": db_status
}