feat: scaffold FastAPI backend with ports-and-adapters layout
This commit is contained in:
parent
eee8195662
commit
c6a737db96
16 changed files with 685 additions and 0 deletions
27
backend/app/main.py
Normal file
27
backend/app/main.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
"""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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue