refactor: cleaned main file

This commit is contained in:
2025-10-31 11:29:24 +04:00
parent 36b3e056dc
commit ef657c4939
8 changed files with 84 additions and 53 deletions

19
core/middlewares.py Normal file
View 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,
)