beego官方自动化文档教程
https://beego.me/docs/advantage/docs.md
首先 bee api beeapi 新建一个 API 应用。
在beego新建的API应用中运行:
bee run -gendoc=true -downdoc=true
-gendoc=true 表示每次自动化的 build 文档,-downdoc=true 就会自动的下载 swagger 文档查看器
一般这时候就可以了,但是有时候无法下载swagger样式包,比如:
Error while downloading 'https://github.com/beego/swagger/archive/v3.zip': Get https://github.com/beego/swagger/archive/v3.zip: proxyconnect tcp: tls: oversized record received with length 20527
此时的在浏览器中打开swagger,swagger缺少样式文件:
解决方法
前往https://github.com/beego/swagger,把swagger的样式文件下载下来
1. 在项目下git clone(如果有swagger文件夹和swagger.zip包记得先删除)
git clone git@github.com:beego/swagger.git
swagger文件夹,里面包含渲染swagger的一些样式文件:
2. 直接下载zip包,到项目下解压到swagger文件夹![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/db86a2a4f3dc0807a7f4e6c218dcd918.png)
此时在项目下重新运行
bee run -gendoc=true -downdoc=true
打开swagger