MCPcopy Index your code
hub / github.com/fastapi/fastapi / __init__

Method __init__

fastapi/routing.py:2008–2024  ·  view source on GitHub ↗
(
        self,
        path: str,
        *,
        directory: str | os.PathLike[str],
        fallback: Literal["auto", "index.html", "404.html"] | None = "auto",
        check_dir: bool = True,
    )

Source from the content-addressed store, hash-verified

2006
2007class _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)

Callers

nothing calls this directly

Calls 2

_normalize_frontend_pathFunction · 0.85

Tested by

no test coverage detected