diff --git a/app/main.py b/app/main.py index e9fd22c..1254159 100644 --- a/app/main.py +++ b/app/main.py @@ -14,15 +14,25 @@ from app.router.send_email_service_router import send_email_service_router from app.router.user_type_router import user_type_router from app.service.news_scheduling_service import schedule_task +from fastapi.middleware.cors import CORSMiddleware app = FastAPI() +# CORS 설정 +origins = ["*"] # 모든 출처 허용 + +app.add_middleware( + CORSMiddleware, + allow_origins=origins, # 모든 출처 허용 + allow_credentials=True, + allow_methods=["*"], # 모든 HTTP 메소드 허용 + allow_headers=["*"], # 모든 HTTP 헤더 허용 +) @app.on_event("startup") async def startup_event(): asyncio.create_task(schedule_task()) - # load env load_dotenv() @@ -40,7 +50,6 @@ async def startup_event(): app.add_exception_handler(Exception, exception_handler) app.add_exception_handler(HTTPException, http_exception_handler) - @app.get("/health") async def health_check(): return {"status": "OK"}