一、说明
默认的接口文档是:ip:port/docs,在我们发布项目的时候会进行Nginx的反向代理,需要设置关键字来转发。类似于SpringBoot中的content-path。方式如下:
二、实现
为接口文档加上api前缀
app = FastAPI(
openapi_url='/api/data_manger.json',
docs_url="/api/docs",
redoc_url="/api/redoc"
)
三、访问
默认的接口文档是:ip:port/docs,在我们发布项目的时候会进行Nginx的反向代理,需要设置关键字来转发。类似于SpringBoot中的content-path。方式如下:
为接口文档加上api前缀
app = FastAPI(
openapi_url='/api/data_manger.json',
docs_url="/api/docs",
redoc_url="/api/redoc"
)