We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d14af5f + 234de63 commit b0e1f8aCopy full SHA for b0e1f8a
1 file changed
getcloser/backend/app/main.py
@@ -1,5 +1,6 @@
1
from fastapi import FastAPI
2
from fastapi.middleware.cors import CORSMiddleware
3
+from fastapi.openapi.utils import get_openapi
4
from dotenv import load_dotenv
5
import os
6
@@ -26,6 +27,22 @@
26
27
redoc_url="/redoc",
28
)
29
30
+# Swagger 기본 경로를 /api 로 지정
31
+def custom_openapi():
32
+ if app.openapi_schema:
33
+ return app.openapi_schema
34
+ openapi_schema = get_openapi(
35
+ title=app.title,
36
+ version=app.version,
37
+ description=app.description,
38
+ routes=app.routes,
39
+ )
40
+ openapi_schema["servers"] = [{"url": "/api"}]
41
+ app.openapi_schema = openapi_schema
42
43
+
44
+app.openapi = custom_openapi
45
46
# CORS 미들웨어 설정
47
origins = os.getenv("CORS_ORIGINS", "").split(",")
48
app.add_middleware(
0 commit comments