first commit

This commit is contained in:
bluebamus committed 2025-12-19 09:36:23 +09:00
commit 1ff70c7925
71 files changed
+4175

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from config import cors_settings
# sys.path.append(
# os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# ) # root 경로 추가
class CustomCORSMiddleware:
def __init__(self, app: FastAPI):
self.app = app
def configure_cors(self):
self.app.add_middleware(
CORSMiddleware,
allow_origins=cors_settings.CORS_ALLOW_ORIGINS,
allow_credentials=cors_settings.CORS_ALLOW_CREDENTIALS,
allow_methods=cors_settings.CORS_ALLOW_METHODS,
allow_headers=cors_settings.CORS_ALLOW_HEADERS,
expose_headers=cors_settings.CORS_EXPOSE_HEADERS,
max_age=cors_settings.CORS_MAX_AGE,
)