Spaces:
Sleeping
Sleeping
File size: 984 Bytes
4eea147 a7591dc 4eea147 2cd3d4e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | """
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
@app.get("/", tags=["Documentation"])
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 |