discovery-by-llm/backend/app/main.py

27 lines
700 B
Python

"""Application factory and wiring. No logic lives here."""
from pathlib import Path
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from app.config import settings
FRONTEND_DIST = Path(__file__).parent / "static"
def create_app() -> FastAPI:
"""Build the FastAPI app: API routes plus the built SPA on one port."""
app = FastAPI(title="discovery-by-llm", docs_url=None, redoc_url=None)
@app.get("/api/health")
def health() -> dict[str, str]:
return {"status": "ok", "mode": settings.app_mode}
if FRONTEND_DIST.is_dir():
app.mount("/", StaticFiles(directory=FRONTEND_DIST, html=True), name="spa")
return app
app = create_app()