Migrate request/response interceptors to FastAPI middleware - Created FastAPI-compatible auth and validation middleware
This commit is contained in:
@@ -34,6 +34,10 @@ from fastapi.templating import Jinja2Templates
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
# Import our custom middleware
|
||||
from web.middleware.fastapi_auth_middleware import AuthMiddleware
|
||||
from web.middleware.fastapi_validation_middleware import ValidationMiddleware
|
||||
|
||||
# Configure logging
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
@@ -246,6 +250,10 @@ app.add_middleware(
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
# Add custom middleware
|
||||
app.add_middleware(AuthMiddleware)
|
||||
app.add_middleware(ValidationMiddleware)
|
||||
|
||||
# Request logging middleware
|
||||
@app.middleware("http")
|
||||
async def log_requests(request: Request, call_next):
|
||||
|
||||
Reference in New Issue
Block a user