(
self,
path: str,
*,
directory: str | os.PathLike[str],
fallback: Literal["auto", "index.html", "404.html"] | None = "auto",
check_dir: bool = True,
)
| 2006 | |
| 2007 | class _FrontendRoute(BaseRoute): |
| 2008 | def __init__( |
| 2009 | self, |
| 2010 | path: str, |
| 2011 | *, |
| 2012 | directory: str | os.PathLike[str], |
| 2013 | fallback: Literal["auto", "index.html", "404.html"] | None = "auto", |
| 2014 | check_dir: bool = True, |
| 2015 | ) -> None: |
| 2016 | if fallback not in {"auto", "index.html", "404.html", None}: |
| 2017 | raise AssertionError( |
| 2018 | "fallback must be 'auto', 'index.html', '404.html', or None" |
| 2019 | ) |
| 2020 | self.path = _normalize_frontend_path(path) |
| 2021 | self.methods = {"GET", "HEAD"} |
| 2022 | self.app = _FrontendStaticFiles( |
| 2023 | directory=directory, fallback=fallback, check_dir=check_dir |
| 2024 | ) |
| 2025 | |
| 2026 | def matches(self, scope: Scope) -> tuple[Match, Scope]: |
| 2027 | return self.matches_with_path(scope, self.path) |
nothing calls this directly
no test coverage detected