M2-T11: serve React SPA from FastAPI and remove Jinja pages
- app/main.py serves the SPA build (SPA_DIST_DIR, default frontend/dist): mounts /assets and a GET catch-all returning index.html for client routes; catch-all 404s on /api/*, never swallows /docs, /openapi.json, /static, assets, ingestion/ticktick/status; skips SPA serving when dist absent (backend-only CI) - delete app/api/routes/pages.py, app/api/routes/auth.py, app/templates/ (all replaced by /api/* + SPA; auth service layer kept) - remove/replace Jinja page tests (JSON coverage already in test_api_*); add tests/test_spa_hosting.py for the fallback contract - regenerate openapi/ (Jinja paths gone) and frontend schema.d.ts
This commit is contained in:
+4
-2
@@ -25,9 +25,11 @@ def _prepare_app_db(tmp_path) -> str:
|
||||
|
||||
|
||||
def test_app_starts(client: TestClient) -> None:
|
||||
# With SPA enabled, GET / is served by the catch-all and returns index.html (200).
|
||||
# Without SPA (e.g. SPA_DIST_DIR points to empty dir), it returns 404.
|
||||
# Either way the app started successfully — just assert it is not a server error.
|
||||
response = client.get("/", follow_redirects=False)
|
||||
assert response.status_code == 303
|
||||
assert response.headers["location"] == "/login"
|
||||
assert response.status_code in (200, 404)
|
||||
|
||||
|
||||
def test_status_endpoint(client: TestClient) -> None:
|
||||
|
||||
Reference in New Issue
Block a user