Spaces:
Sleeping
Sleeping
| """ | |
| Main application module for Customer Hub Service. | |
| """ | |
| import logging | |
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from fastapi.responses import RedirectResponse | |
| from app.routers.router import router | |
| # Configure logging | |
| logging.basicConfig(level=logging.INFO) | |
| #logger = logging.getLogger(__name__) | |
| app = FastAPI( | |
| title="Authentication API's", | |
| description="API for managing registration and login related services", | |
| version="1.0.0", | |
| ) | |
| # CORS configuration | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], # Restrict to specific domains in production | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| # Add root endpoint that redirects to docs | |
| async def root(): | |
| """Redirect to API documentation""" | |
| return RedirectResponse(url="/docs") | |
| # Register routers | |
| app.include_router(router, prefix="/api/v1", ) | |
| # Ensure there is no trailing newline |