Spaces:
Sleeping
Sleeping
Update app/main.py
Browse files- app/main.py +36 -30
app/main.py
CHANGED
|
@@ -1,31 +1,37 @@
|
|
| 1 |
-
"""
|
| 2 |
-
Main application module for Customer Hub Service.
|
| 3 |
-
"""
|
| 4 |
-
import logging
|
| 5 |
-
from fastapi import FastAPI
|
| 6 |
-
from fastapi.middleware.cors import CORSMiddleware
|
| 7 |
-
from app.routers.router import router
|
| 8 |
-
|
| 9 |
-
# Configure logging
|
| 10 |
-
logging.basicConfig(level=logging.INFO)
|
| 11 |
-
#logger = logging.getLogger(__name__)
|
| 12 |
-
|
| 13 |
-
app = FastAPI(
|
| 14 |
-
title="Authentication API's",
|
| 15 |
-
description="API for managing registration and login related services",
|
| 16 |
-
version="1.0.0",
|
| 17 |
-
)
|
| 18 |
-
|
| 19 |
-
# CORS configuration
|
| 20 |
-
app.add_middleware(
|
| 21 |
-
CORSMiddleware,
|
| 22 |
-
allow_origins=["*"], # Restrict to specific domains in production
|
| 23 |
-
allow_credentials=True,
|
| 24 |
-
allow_methods=["*"],
|
| 25 |
-
allow_headers=["*"],
|
| 26 |
-
)
|
| 27 |
-
|
| 28 |
-
#
|
| 29 |
-
app.
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
# Ensure there is no trailing newline
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Main application module for Customer Hub Service.
|
| 3 |
+
"""
|
| 4 |
+
import logging
|
| 5 |
+
from fastapi import FastAPI
|
| 6 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 7 |
+
from app.routers.router import router
|
| 8 |
+
|
| 9 |
+
# Configure logging
|
| 10 |
+
logging.basicConfig(level=logging.INFO)
|
| 11 |
+
#logger = logging.getLogger(__name__)
|
| 12 |
+
|
| 13 |
+
app = FastAPI(
|
| 14 |
+
title="Authentication API's",
|
| 15 |
+
description="API for managing registration and login related services",
|
| 16 |
+
version="1.0.0",
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
# CORS configuration
|
| 20 |
+
app.add_middleware(
|
| 21 |
+
CORSMiddleware,
|
| 22 |
+
allow_origins=["*"], # Restrict to specific domains in production
|
| 23 |
+
allow_credentials=True,
|
| 24 |
+
allow_methods=["*"],
|
| 25 |
+
allow_headers=["*"],
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
# Add root endpoint that redirects to docs
|
| 29 |
+
@app.get("/", tags=["Documentation"])
|
| 30 |
+
async def root():
|
| 31 |
+
"""Redirect to API documentation"""
|
| 32 |
+
return RedirectResponse(url="/docs")
|
| 33 |
+
|
| 34 |
+
# Register routers
|
| 35 |
+
app.include_router(router, prefix="/api/v1", )
|
| 36 |
+
|
| 37 |
# Ensure there is no trailing newline
|