import os from fastapi import FastAPI from fastapi.staticfiles import StaticFiles from fastapi.middleware.cors import CORSMiddleware # Import your main logic functions if needed # from main import ... app = FastAPI() app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_methods=["*"], allow_headers=["*"], ) # Create and mount static folder STATIC_DIR = "static" if not os.path.exists(STATIC_DIR): os.makedirs(STATIC_DIR) app.mount("/static", StaticFiles(directory=STATIC_DIR), name="static") @app.get("/simulate") async def start_simulation(): try: return { "db_url": "/static/dashboard.png", } except Exception as e: return {"error": str(e)} if __name__ == "__main__": import uvicorn uvicorn.run(app, host="0.0.0.0", port=8000)