Cleaner and non-deprecated typing for template app module. Avoids ruff errors with strict configurations.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"""FastAPI application module with Vue frontend integration."""
|
||||
|
||||
from collections.abc import AsyncIterator
|
||||
from collections.abc import AsyncGenerator
|
||||
from contextlib import asynccontextmanager
|
||||
from pathlib import Path
|
||||
|
||||
@@ -13,7 +13,7 @@ frontend = Frontend(Path(__file__).with_name("frontend-build"))
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(_app: FastAPI) -> AsyncIterator[None]:
|
||||
async def lifespan(_app: FastAPI) -> AsyncGenerator:
|
||||
"""Manage app startup and shutdown resources."""
|
||||
await frontend.load()
|
||||
yield
|
||||
@@ -27,7 +27,7 @@ app = FastAPI(title="PROJECT_TITLE", debug=DEVMODE, lifespan=lifespan)
|
||||
|
||||
# Health check endpoint for the Vue demo app to verify the backend is running
|
||||
@app.get("/api/health")
|
||||
async def health_check() -> dict[str, str]:
|
||||
async def health_check() -> dict:
|
||||
"""Return backend status for health monitoring."""
|
||||
return {"status": "ok"}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user