🔧修复:debug关闭时关闭内置文档,加入根目录提示

This commit is contained in:
2025-08-03 17:04:32 +08:00
parent cd24bca29e
commit 9e428c2eb2

View File

@@ -50,6 +50,9 @@ app = FastAPI(
description=app_config.description,
version=app_config.version,
debug=app_config.debug,
docs_url=None if not app_config.debug else "/docs",
redoc_url=None if not app_config.debug else "/redoc",
openapi_url=None if not app_config.debug else "/openapi.json",
)
# CORS配置
@@ -60,6 +63,11 @@ app.add_middleware(
allow_methods=app_config.cors_allow_methods,
allow_headers=app_config.cors_allow_headers,
)
@app.get("/")
async def root():
return {"message": "Hello World"}
app.include_router(invite_router)
app.include_router(jwc_router)
app.include_router(login_router)