nonebot2/packages/nonebot-plugin-docs/nonebot_plugin_docs/drivers/fastapi.py
2022-01-08 19:36:19 +08:00

13 lines
340 B
Python

from pathlib import Path
from nonebot.drivers.fastapi import Driver
from fastapi.staticfiles import StaticFiles
def register_route(driver: Driver):
app = driver.server_app
static_path = str((Path(__file__).parent / ".." / "dist").resolve())
app.mount("/website", StaticFiles(directory=static_path, html=True), name="docs")