diff --git a/main.py b/main.py index 4d7e9f5..a41765d 100644 --- a/main.py +++ b/main.py @@ -27,11 +27,26 @@ app.add_middleware( # Include API router app.include_router(api_router, prefix=settings.API_V1_STR) -# Root route to redirect to documentation -@app.get("/", include_in_schema=False) +# Root route to return API information +@app.get("/", tags=["Root"]) async def root(): - from fastapi.responses import RedirectResponse - return RedirectResponse(url="/docs") + return { + "name": settings.PROJECT_NAME, + "version": settings.VERSION, + "description": "Welcome to the E-commerce API", + "docs": "/docs", + "redoc": "/redoc", + "api_prefix": settings.API_V1_STR, + "endpoints": { + "health": "/health", + "auth": f"{settings.API_V1_STR}/auth", + "users": f"{settings.API_V1_STR}/users", + "products": f"{settings.API_V1_STR}/products", + "categories": f"{settings.API_V1_STR}/categories", + "cart": f"{settings.API_V1_STR}/cart", + "orders": f"{settings.API_V1_STR}/orders" + } + } # Health check endpoint @app.get("/health", tags=["Health"])