File size: 781 Bytes
ef1ad9e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from fastapi import FastAPI, HTTPException
from fastapi.exceptions import RequestValidationError
from app.utils.app_logger.exception_handlers import request_validation_exception_handler, http_exception_handler, unhandled_exception_handler
from app.utils.app_logger.middleware import log_request_middleware
from app.routers import auth_router

app = FastAPI()

# initialize logger
app.middleware("http")(log_request_middleware)
app.add_exception_handler(RequestValidationError,
                          request_validation_exception_handler)
app.add_exception_handler(HTTPException, http_exception_handler)
app.add_exception_handler(Exception, unhandled_exception_handler)

# initialize routes
app.include_router(auth_router.router, prefix="/auth", tags=["Auth0"])