mirror of
				https://github.com/nonebot/nonebot2.git
				synced 2025-10-31 23:16:41 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			15 lines
		
	
	
		
			365 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			365 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("/docs",
 | |
|               StaticFiles(directory=static_path, html=True),
 | |
|               name="docs")
 |