mirror of
https://github.com/Jerryplusy/AI-powered-switches.git
synced 2025-07-04 21:29:18 +00:00
23 lines
628 B
Python
23 lines
628 B
Python
from fastapi import FastAPI
|
|
from src.backend.app.api.endpoints import router as api_router
|
|
from src.backend.app.utils.logger import setup_logging
|
|
from src.backend.config import settings
|
|
|
|
|
|
def create_app() -> FastAPI:
|
|
# 设置日志
|
|
setup_logging()
|
|
|
|
# 创建FastAPI应用
|
|
app = FastAPI(
|
|
title=settings.APP_NAME,
|
|
debug=settings.DEBUG,
|
|
docs_url=f"{settings.API_PREFIX}/docs",
|
|
redoc_url=f"{settings.API_PREFIX}/redoc",
|
|
openapi_url=f"{settings.API_PREFIX}/openapi.json"
|
|
)
|
|
|
|
# 添加API路由
|
|
app.include_router(api_router, prefix=settings.API_PREFIX)
|
|
|
|
return app |