wag-services-and-backend-la.../ApiServices/AuthApiService/app.py

28 lines
869 B
Python

"""
FastAPI Application Entry Point
This module initializes and configures the FastAPI application with:
- CORS middleware for cross-origin requests
- Request timing middleware for performance monitoring
- Custom exception handlers for consistent error responses
- Prometheus instrumentation for metrics
- API routers for endpoint organization
"""
import uvicorn
from prometheus_fastapi_instrumentator import Instrumentator
from app_handler import setup_middleware
from create_file import create_app
from config import ApiConfig
app = create_app() # Initialize FastAPI application
Instrumentator().instrument(app=app).expose(app=app) # Setup Prometheus metrics
setup_middleware(app) # Configure middleware and exception handlers
if __name__ == "__main__":
# Run the application with Uvicorn
uvicorn.Server(uvicorn.Config(**ApiConfig.as_dict())).run()