from multiprocessing import Process from typing import Any from fastapi import FastAPI from fastapi.responses import HTMLResponse from starlette.middleware.cors import CORSMiddleware from starlette.middleware.trustedhost import TrustedHostMiddleware from jb.config import settings from jb.settings import BASE_HTML, load_manifest from jb.views.auth import auth_router from jb.views.common import common_router app = FastAPI( servers=[ { "url": "https://jamesbillings67.com/", "description": "Production environment", }, ], title="jb", version="1.0.0", ) app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) app.add_middleware(TrustedHostMiddleware, allowed_hosts=["*"]) app.include_router(router=common_router) app.include_router(router=auth_router) @app.get("/robots.txt") @app.get("/sitemap.xml") @app.get("/favicon.ico") def return_nothing() -> dict[str, Any]: return {} @app.get("/{full_path:path}") def serve_react_app(full_path: str): manifest = load_manifest() entry = manifest["src/main.tsx"] js_file = entry["file"] css_file = manifest["style.css"]["file"] html = f"""