mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-13 11:06:40 +07:00
fix: /api/docs возвращал 404 вместо Swagger UI
FastAPI регистрировал встроенные роуты документации на дефолтных путях (/docs, /openapi.json), в то время как все остальные роуты подключены с префиксом /api и только его проксирует nginx. Теперь docs_url/redoc_url/ openapi_url явно указаны под /api, поэтому Swagger UI доступен там же, где его и ищут (как заявлено в README).
This commit is contained in:
@@ -38,7 +38,18 @@ async def lifespan(app: FastAPI):
|
|||||||
yield
|
yield
|
||||||
|
|
||||||
|
|
||||||
app = FastAPI(title="Aurum API", version=APP_VERSION, lifespan=lifespan)
|
app = FastAPI(
|
||||||
|
title="Aurum API",
|
||||||
|
version=APP_VERSION,
|
||||||
|
lifespan=lifespan,
|
||||||
|
# Docs live under /api/* because nginx only proxies that prefix to the
|
||||||
|
# backend (see frontend/nginx.conf) — everything else falls through to
|
||||||
|
# the SPA's index.html, which is why the defaults (/docs, /openapi.json)
|
||||||
|
# would silently 404 through the reverse proxy.
|
||||||
|
docs_url="/api/docs",
|
||||||
|
redoc_url="/api/redoc",
|
||||||
|
openapi_url="/api/openapi.json",
|
||||||
|
)
|
||||||
|
|
||||||
# CORS stays off unless someone deliberately opens it, and credentials are
|
# CORS stays off unless someone deliberately opens it, and credentials are
|
||||||
# only granted to a pinned list. Starlette answers a credentialed "*" by
|
# only granted to a pinned list. Starlette answers a credentialed "*" by
|
||||||
|
|||||||
Reference in New Issue
Block a user