refactor: improve code structure and optimize key functions

This commit is contained in:
Cheng Zhou
2025-12-16 15:55:08 +08:00
commit 223d445a94
1290 changed files with 1361 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.api.v1.router import api_router
from app.core.config import settings
def create_app() -> FastAPI:
app = FastAPI(
title="CTMS API",
version="0.1.0",
debug=settings.ENV == "development",
)
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get("/health", tags=["health"])
async def health() -> dict[str, str]:
return {"status": "ok"}
app.include_router(api_router, prefix="/api/v1")
return app
app = create_app()