From 72105cba261e854bba436e0fd72537d824c9f150 Mon Sep 17 00:00:00 2001 From: SR07 Date: Wed, 11 Jun 2025 11:42:08 +0900 Subject: [PATCH] =?UTF-8?q?=EC=B9=9C=EA=B5=AC=20=EC=9E=91=EC=97=85?= =?UTF-8?q?=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/main.py | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/app/main.py b/app/main.py index a08ed8f..5007aee 100644 --- a/app/main.py +++ b/app/main.py @@ -12,33 +12,33 @@ from app.api import user, auth, character, homework, character_homework, dashboa oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/api/auth/login") +# app = FastAPI( +# title="숙제노기 API", +# description="마비노기 모바일 숙제 관리용 백엔드 API", +# version="0.1.0", +# docs_url="/docs", +# redoc_url=None, +# openapi_url="/openapi.json", +# root_path="/api" +# ) + app = FastAPI( - title="숙제노기 API", - description="마비노기 모바일 숙제 관리용 백엔드 API", - version="0.1.0", - docs_url="/docs", + docs_url=None, redoc_url=None, - openapi_url="/openapi.json", - root_path="/api" + openapi_url=None ) -# app = FastAPI( -# docs_url=None, -# redoc_url=None, -# openapi_url=None -# ) -# -# @app.get("/docs", include_in_schema=False) -# def custom_docs(user=Depends(get_current_user)): -# return get_swagger_ui_html(openapi_url="/openapi.json", title="Sukjenogi API Docs") -# -# @app.get("/openapi.json", include_in_schema=False) -# def custom_openapi(user=Depends(get_current_user)): -# return get_openapi( -# title="Sukjenogi API", -# version="0.2", -# routes=app.routes -# ) +@app.get("/docs", include_in_schema=False) +def custom_docs(user=Depends(get_current_user)): + return get_swagger_ui_html(openapi_url="/openapi.json", title="Sukjenogi API Docs") + +@app.get("/openapi.json", include_in_schema=False) +def custom_openapi(user=Depends(get_current_user)): + return get_openapi( + title="Sukjenogi API", + version="0.2", + routes=app.routes + ) @app.middleware("http") async def log_exceptions_middleware(request: Request, call_next): @@ -58,8 +58,8 @@ origins = [ app.add_middleware( CORSMiddleware, - # allow_origins=origins, - allow_origins=["*"], + allow_origins=origins, + # allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"],