This repository has been archived on 2022-02-09. You can view files and clone it, but cannot push or open issues or pull requests.
disclosemypay.org/section7/router/__init__.py

24 lines
725 B
Python

from typing import Callable
from typing import NamedTuple
from typing import Sequence
from typing import Tuple
from section7.router.error_handler import handle_error
from section7.router.home import display_home
class Routable(NamedTuple):
"""Structure for storing details for a given route
:param route: String indicating the Flask URL rule to apply to the route entry
:param entrypoint: The callable that Flask should invoke when the route is accessed
:param methods: Sequence of HTTP method verbs that should be accepted by the route
"""
route: str
entrypoint: Callable
methods: Sequence[str] = ("GET",)
ROUTES: Tuple[Routable, ...] = (Routable(route="/", entrypoint=display_home),)