refactor: cleaned main file
This commit is contained in:
19
core/middlewares.py
Normal file
19
core/middlewares.py
Normal file
@ -0,0 +1,19 @@
|
||||
from fastapi.applications import AppType
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.middleware.gzip import GZipMiddleware
|
||||
|
||||
from .app_settings import settings
|
||||
|
||||
|
||||
def register_middlewares(app: AppType):
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=settings.ORIGINS,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
app.add_middleware(
|
||||
GZipMiddleware,
|
||||
minimum_size=1_000,
|
||||
)
|
||||
Reference in New Issue
Block a user