33 lines
817 B
Python
33 lines
817 B
Python
"""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.
|
|
"""
|
|
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"
|
|
|
|
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/hello")
|
|
def hello():
|
|
return {"msg": "backend is live"}
|
|
|
|
|
|
@app.get("/")
|
|
def index():
|
|
return FileResponse(STATIC_DIR / "index.html")
|