Home / Function/ route() — fastapi Function Reference

route() — fastapi Function Reference

Architecture documentation for the route() function in routing.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  6cff2dad_2230_1fe5_9de2_64e60765b27c["route()"]
  ecadd3bc_0c58_b4e5_06d8_57da79199adc["APIRouter"]
  6cff2dad_2230_1fe5_9de2_64e60765b27c -->|defined in| ecadd3bc_0c58_b4e5_06d8_57da79199adc
  fbb5c527_c628_1375_0b4b_0dc27f28dba6["__init__()"]
  fbb5c527_c628_1375_0b4b_0dc27f28dba6 -->|calls| 6cff2dad_2230_1fe5_9de2_64e60765b27c
  style 6cff2dad_2230_1fe5_9de2_64e60765b27c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fastapi/routing.py lines 1001–1018

    def route(
        self,
        path: str,
        methods: Optional[Collection[str]] = None,
        name: Optional[str] = None,
        include_in_schema: bool = True,
    ) -> Callable[[DecoratedCallable], DecoratedCallable]:
        def decorator(func: DecoratedCallable) -> DecoratedCallable:
            self.add_route(
                path,
                func,
                methods=methods,
                name=name,
                include_in_schema=include_in_schema,
            )
            return func

        return decorator

Domain

Subdomains

Defined In

Called By

Frequently Asked Questions

What does route() do?
route() is a function in the fastapi codebase, defined in fastapi/routing.py.
Where is route() defined?
route() is defined in fastapi/routing.py at line 1001.
What calls route()?
route() is called by 1 function(s): __init__.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free