"""chart.amow.com — FastAPI backend. Placeholder app: serves the Vue 3 single-page frontend from static/ and a couple of JSON endpoints under /api. Replace the endpoints as the real app takes shape; the serving/deploy wiring below does not need to change. """ import os from pathlib import Path from fastapi import FastAPI from fastapi.responses import FileResponse from fastapi.staticfiles import StaticFiles BASE_DIR = Path(__file__).parent STATIC_DIR = BASE_DIR / "static" # Coolify injects the deployed commit; absent when running locally. SOURCE_COMMIT = os.environ.get("SOURCE_COMMIT", "dev") app = FastAPI(title="chart") app.mount("/static", StaticFiles(directory=STATIC_DIR), name="static") @app.get("/api/health") def health(): return {"status": "ok", "service": "chart"} @app.get("/api/version") def version(): """Which commit is actually serving. `bin/wait-deploy` polls this.""" return {"commit": SOURCE_COMMIT} @app.get("/api/hello") def hello(): return {"msg": "this is fing awesome"} @app.get("/") def index(): return FileResponse(STATIC_DIR / "index.html")