Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load API definition. #102

Open
GiHccTpD opened this issue Apr 28, 2021 · 2 comments
Open

Failed to load API definition. #102

GiHccTpD opened this issue Apr 28, 2021 · 2 comments

Comments

@GiHccTpD
Copy link

线上:image
本地:image
由于线上会增加一个路由的前缀,会导致无法加载API

@best-fan
Copy link

best-fan commented Aug 25, 2022

我目前的方式是直接修改包中swagger-ui.html文件,即可满足要求
image
例如线上地址为:https://www.demo.cn/driver/swagger-ui.html

@LeoFengFromChina
Copy link

我目前的方式是直接修改包中swagger-ui.html文件,即可满足要求 image 例如线上地址为:https://www.demo.cn/driver/swagger-ui.html

我也遇到相同的问题。楼上的这种解决方式,适合于本地调试,直接修改插件的源码。但是如果持续构建部署到服务器(举例docker),可以在你的.Dockerfile文件中,新增语句:
RUN sed -i 's/swagger-doc/你的basePath\/swagger-doc/g' ./node_modules/egg-swagger-doc/app/public/swagger-ui.html

另外,你的basePath也要在自己项目的Config对应环境下修改exports.swaggerdoc中配置basePath(与apiInfo平级),参考你的项目可以配置如:basePath:"/deviceDataMq",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants