This commit is contained in:
암냥 2025-09-13 16:18:28 +09:00
commit 40266cc6e5
191 changed files with 5022 additions and 0 deletions

21
Backend/router/router.py Normal file
View file

@ -0,0 +1,21 @@
import os
import traceback
from fastapi import APIRouter
from fastapi.logger import logger
router = APIRouter()
for router_file in os.listdir("Backend/router/endpoints"):
try:
if router_file.endswith(".py"):
module_name = "Backend.router.endpoints." + router_file[:-3]
module = __import__(module_name, fromlist=[""])
router_object = getattr(module, "router")
prefix = getattr(module, "prefix", router_file[:-3])
router.include_router(router_object, prefix="/api", tags=[router_file[:-3]])
print(f"Loaded router: /api/{prefix} - {router_file}")
except Exception as e:
logger.error(f"Error loading router {router_file}:\n{traceback.format_exc()}")