Files
connectionmachine/src/editor_app/main.py
Jimmy f9bf119af6 Add initial web editor app, CLI scripts, and test scaffolding.
This introduces the FastAPI editor implementation and related project setup so the app can be run and validated locally.

Made-with: Cursor
2026-04-11 02:14:26 +12:00

29 lines
872 B
Python

from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from editor_app.config import STATIC_DIR, WORKSPACE_ROOT
from editor_app.routers.files import router as files_router
from editor_app.routers.frontend import router as frontend_router
from editor_app.routers.python_exec import router as python_router
def create_app() -> FastAPI:
app = FastAPI()
app.mount("/static", StaticFiles(directory=str(STATIC_DIR)), name="static")
app.include_router(frontend_router)
app.include_router(files_router)
app.include_router(python_router)
@app.on_event("startup")
async def run_configured_startup_script() -> None:
from editor_app.services import python_runner
(WORKSPACE_ROOT / "lib").mkdir(parents=True, exist_ok=True)
python_runner.run_startup_script_if_configured()
return app
app = create_app()