feat: Refactor backend structure by moving main application and router files to backend_domains

This commit is contained in:
2025-06-22 10:05:04 +02:00
parent a2873e4c85
commit fa33321ff1
4 changed files with 2 additions and 2 deletions
View File
+27
View File
@@ -0,0 +1,27 @@
# backend/main.py
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from backend.backend_domains.router_v1 import router
from backend.backend_domains.llms import llm_chat_ws_endpoint_v1
app = FastAPI(
title="Fitz Backend",
description="API para interacción con el frontend y ejecución de tareas",
version="0.1.0"
)
# Configuración de CORS
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:5173", "http://0.0.0.0:5173"], # Solo permite tu frontend local
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# Incluye las rutas de tu API
app.include_router(router, prefix="/api/v1", tags=["v1"])
app.include_router(llm_chat_ws_endpoint_v1.router)
+15
View File
@@ -0,0 +1,15 @@
# backend/api/router_v1.py
from fastapi import APIRouter
from backend.backend_domains.experiments import charts_examples_endpoint_v1 as charts
from backend.backend_domains.experiments import ping_endpoint_v1
from backend.backend_domains.text_manager import text_manager_endpoint_v1
from backend.backend_domains.llms import llm_chat_endpoint_v1
from backend.backend_domains.usuarios_endpoint_v1 import router as usuarios_router
router = APIRouter()
router.include_router(ping_endpoint_v1.router, prefix="/ping")
router.include_router(text_manager_endpoint_v1.router, prefix="/text_manager")
router.include_router(charts.router, prefix="/charts")
router.include_router(llm_chat_endpoint_v1.router, prefix="/llm", tags=["Agente LLM"])
router.include_router(usuarios_router, prefix="/usuarios", tags=["Usuarios"])