/ fastapi-template / api / endpoints / __init__.py
__init__.py
 1  from typing import Any
 2  
 3  from fastapi import APIRouter
 4  
 5  from . import test
 6  from .internal import INTERNAL_ROUTERS
 7  from ..auth import internal_auth
 8  
 9  
10  ROUTER = APIRouter()
11  TAGS: list[dict[str, Any]] = []
12  
13  for module in [test]:
14      name = module.__name__.split(".")[-1]
15      router = APIRouter(tags=[name])
16      router.include_router(module.router)
17      ROUTER.include_router(router)
18  
19      TAGS.append({"name": name, "description": module.__doc__ or ""})
20  
21  TAGS.append({"name": "internal", "description": "Internal endpoints"})
22  
23  for r in INTERNAL_ROUTERS:
24      router = APIRouter(prefix="/_internal", tags=["internal"], dependencies=[internal_auth])
25      router.include_router(r)
26      ROUTER.include_router(router)