app/liteyukibot/asgi/__init__.py
Snowykami efb13340f0
Some checks failed
Pytest API Testing / Pytes-API-Testing (push) Failing after 17s
🔧 添加获取 FastAPI 实例的函数,更新配置文件路径以支持新的源文件
2025-04-29 02:55:38 +08:00

19 lines
436 B
Python

import uvicorn
from fastapi import FastAPI
app = FastAPI()
def get_app() -> FastAPI:
"""获取 FastAPI 实例"""
return app
@app.get("/")
async def root():
return {"message": "Hello LiteyukiBot"}
async def run_app(**kwargs):
"""ASGI app 启动函数,在所有插件加载完后任务启动"""
config = uvicorn.Config(app, **kwargs, log_config=None)
server = uvicorn.Server(config)
await server.serve()