docs/examples/static_files/custom_router.py
raw| 1 | from litestar import Litestar |
| 2 | from litestar.router import Router |
| 3 | from litestar.static_files import create_static_files_router |
| 4 | |
| 5 | |
| 6 | class MyRouter(Router): |
| 7 | pass |
| 8 | |
| 9 | |
| 10 | app = Litestar( |
| 11 | route_handlers=[ |
| 12 | create_static_files_router( |
| 13 | path="/static", |
| 14 | directories=["assets"], |
| 15 | router_class=MyRouter, |
| 16 | ) |
| 17 | ] |
| 18 | ) |