mirror of
https://github.com/snailyp/gemini-balance.git
synced 2026-05-11 10:00:37 +08:00
36 lines
664 B
Python
36 lines
664 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from app.core.logger import get_main_logger
|
|
|
|
from app.api.routes import router
|
|
import uvicorn
|
|
|
|
# 配置日志
|
|
logger = get_main_logger()
|
|
|
|
app = FastAPI()
|
|
|
|
# 允许跨域
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# 包含所有路由
|
|
app.include_router(router)
|
|
|
|
|
|
@app.get("/health")
|
|
@app.get("/")
|
|
async def health_check():
|
|
logger.info("Health check endpoint called")
|
|
return {"status": "healthy"}
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
uvicorn.run(app, host="0.0.0.0", port=8001)
|