32 lines
690 B
Python
32 lines
690 B
Python
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()
|