以下是一些CentOS上使用Swagger的案例分享:
curl -sL https://rpm.nodesource.com/setup_14.x | sudo -E bash -,再sudo yum install -y nodejs。git clone https://github.com/swagger-api/swagger-ui.git,然后cd到项目目录安装依赖npm install。index.js文件配置Swagger UI,如指定静态文件目录等,然后node index.js启动,通过浏览器访问http://localhost:3000查看。sudo yum install -y java-1.8.0-openjdk-devel和sudo yum install -y maven安装。pom.xml中添加springfox-swagger2和springfox-swagger-ui依赖。@EnableSwagger2注解等配置相关信息。http://localhost:8080/swagger-ui.html访问Swagger UI查看和测试API文档。