Files
2026-05-29 13:27:41 +08:00

53 lines
1.5 KiB
Python

from __future__ import annotations
import logging
import sys
from fastapi import FastAPI
# 让应用自己的 logger(app.*)在 INFO 级别输出到 stdout/journal,
# uvicorn 自带 logging config 只管它自己的 access log
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s %(levelname)s %(name)s: %(message)s",
stream=sys.stdout,
)
from app import db
from app.api.arena import router as arena_router
from app.api.auth import router as auth_router
from app.api.parse import router as parse_router
from app.api.parse_image import router as parse_image_router
from app.api.parse_ocr import router as parse_ocr_router
from app.api.parse_text import router as parse_text_router
from app.api.protect import router as protect_router
from app.api.quick_quote import router as quick_quote_router
from app.api.wish import router as wish_router
from app.api.worth_buy import router as worth_buy_router
app = FastAPI(title="DuoBiBi Mock", version="1.0.0")
@app.on_event("startup")
def _startup() -> None:
# IF NOT EXISTS 建表,首次启动建库 + 后续启动无害
db.init_schema()
app.include_router(parse_router)
app.include_router(parse_image_router)
app.include_router(parse_ocr_router)
app.include_router(parse_text_router)
app.include_router(protect_router)
app.include_router(quick_quote_router)
app.include_router(auth_router)
app.include_router(wish_router)
# 多比比新增端点
app.include_router(arena_router)
app.include_router(worth_buy_router)
@app.get("/health")
async def health() -> dict[str, str]:
return {"status": "ok"}