diff --git a/RAGManager/app/api/routes/__init__.py b/RAGManager/app/api/routes/__init__.py index 2fe6a3c..ef443ea 100644 --- a/RAGManager/app/api/routes/__init__.py +++ b/RAGManager/app/api/routes/__init__.py @@ -1,2 +1,9 @@ """API routes package.""" +from fastapi import APIRouter + +from app.api.routes import documents + +router = APIRouter(prefix="/api/v1") + +router.include_router(documents.router) \ No newline at end of file diff --git a/RAGManager/app/api/routes/admin.py b/RAGManager/app/api/routes/admin.py deleted file mode 100644 index e69de29..0000000 diff --git a/RAGManager/app/api/routes/base.py b/RAGManager/app/api/routes/base.py new file mode 100644 index 0000000..39d82af --- /dev/null +++ b/RAGManager/app/api/routes/base.py @@ -0,0 +1,11 @@ +from fastapi import APIRouter + +router = APIRouter(tags=["base"]) + +@router.get("/") +async def root(): + return {"message": "RAGManager up"} + +@router.get("/health") +def health_check(): + return {"message": "200 running..."} diff --git a/RAGManager/main.py b/RAGManager/main.py index fb6290b..dd6914a 100644 --- a/RAGManager/main.py +++ b/RAGManager/main.py @@ -1,8 +1,8 @@ import logging from fastapi import FastAPI -from sqlalchemy.exc import OperationalError -from app.api.routes import documents +from app.api.routes import router as api_router +from app.api.routes.base import router as base_router from app.core.database_connection import init_db # Configure logging @@ -13,9 +13,11 @@ app = FastAPI(title="RAG Manager API", version="0.1.0") -# Include routers -app.include_router(documents.router) +# Global (non-versioned) routes +app.include_router(base_router) +# Versioned API routes +app.include_router(api_router) @app.on_event("startup") async def startup_event(): @@ -25,16 +27,4 @@ async def startup_event(): logging.info("Database initialized successfully") except Exception as e: logging.error(f"Failed to initialize database: {e}") - raise - - -@app.get("/") -async def root(): - return {"message": "Hello World"} - - -@app.get("/health") -def health_check(): - return {"message": "200 corriendo..."} - - + raise \ No newline at end of file