28 lines
750 B
Python
28 lines
750 B
Python
# 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)
|