Automated Action 8575427c43 Implement user authentication flow
- Setup project structure with FastAPI
- Create user models with SQLAlchemy
- Implement JWT authentication
- Create auth endpoints (register, login, me)
- Add health endpoint
- Generate Alembic migrations
- Update documentation

Generated with BackendIM... (backend.im)
2025-05-12 17:00:50 +00:00

27 lines
646 B
Python

from fastapi import APIRouter, Depends
from sqlalchemy.orm import Session
from app.db.session import get_db
router = APIRouter()
@router.get("/health")
def health_check(db: Session = Depends(get_db)):
"""
Health check endpoint.
Returns:
dict: Status indicating the health of the application and its dependencies
"""
# Check database connection
try:
# Execute a simple query to check DB connection
db.execute("SELECT 1")
db_status = "healthy"
except Exception as e:
db_status = f"unhealthy: {str(e)}"
return {
"status": "up",
"database": db_status,
}