from pathlib import Path

from fastapi import FastAPI

from .routers import api, html


PROJECT_ROOT = Path(__file__).resolve().parents[1]
PUBLIC_DIR = PROJECT_ROOT / "public"

app = FastAPI()
app.include_router(html.router)
app.include_router(api.router)

# FastAPI routes are checked first. If no route matches, files from public/
# are served as the app shell and static assets.
app.frontend("/", directory=PUBLIC_DIR, fallback=None)
