diff --git a/app/main.py b/app/main.py index 1254159..3d39656 100644 --- a/app/main.py +++ b/app/main.py @@ -1,7 +1,9 @@ import asyncio +from typing import Optional from dotenv import load_dotenv from fastapi import FastAPI +from fastapi.middleware.cors import CORSMiddleware from starlette.exceptions import HTTPException from app.config.exception_handler import exception_handler, http_exception_handler @@ -14,7 +16,6 @@ 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() @@ -29,10 +30,12 @@ allow_headers=["*"], # 모든 HTTP 헤더 허용 ) + @app.on_event("startup") async def startup_event(): asyncio.create_task(schedule_task()) + # load env load_dotenv() @@ -50,6 +53,7 @@ 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(): +async def health_check(q: Optional[str] = None): # pylint: disable=unused-argument return {"status": "OK"}