https://github.com/jiaxiaolei/swagger-editor.git
简介:
swagger 在github 上有仓库。这里是我fork的一个地址。
使用实例:
- 基础环境
$ node -v
v6.11.1
$ npm -v
3.10.10
$ cnpm -v
cnpm@5.1.1 (/usr/lib/node_modules/cnpm/lib/parse_argv.js)
npm@5.3.0 (/usr/lib/node_modules/cnpm/node_modules/npm/lib/npm.js)
node@6.11.1 (/usr/bin/node)
npminstall@3.1.1 (/usr/lib/node_modules/cnpm/node_modules/npminstall/lib/index.js)
prefix=/usr
linux x64 3.10.0-514.26.2.el7.x86_64
registry=http://registry.npm.taobao.org
fork 一份 swagger 的代码(https://github.com/swagger-api/swagger-editor), 得到https://github.com/jiaxiaolei/swagger-editor.
clone 一份代码:
$ git clone https://github.com/jiaxiaolei/swagger-editor
安装依赖包:
$ cd swagger-editor
$ cnpm install
NOTE: 用原生的npm 安装,一大堆依赖失败。用cnpm安装成功。
- 启动项目
$ npm start
> swagger-editor@3.1.7 prestart /root/software/swagger-editor
> npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN eslint-config-standard@6.2.1 requires a peer of eslint@>=3.8.1 but none was installed.
npm WARN eslint-config-standard-jsx@3.2.0 requires a peer of eslint@>=3.0.0 but none was installed.
npm WARN eslint-plugin-standard@2.0.1 requires a peer of eslint@>=3.0.0 but none was installed.
npm WARN react-addons-shallow-compare@0.14.8 requires a peer of react@^0.14.8 but none was installed.
npm WARN react-object-inspector@0.2.1 requires a peer of react@^0.14.0 but none was installed.
npm WARN webpack-dev-server@2.5.0 requires a peer of webpack@^2.2.0 but none was installed.
> swagger-editor@3.1.7 start /root/software/swagger-editor
> npm-run-all --parallel serve-static open-static
> swagger-editor@3.1.7 serve-static /root/software/swagger-editor
> http-server -i -a 0.0.0.0 -p 3001
> swagger-editor@3.1.7 open-static /root/software/swagger-editor
> node -e 'require("open")("http://localhost:3001")'
Starting up http-server, serving ./
Available on:
http://127.0.0.1:3001
http://172.28.32.51:3001
http://172.28.32.57:3001
Hit CTRL-C to stop the server
扩展阅读:
Swagger
http://www.jianshu.com/p/4115f2b53983
简介:
swagger学习
Swagger定义
Swagger同类工具
Swagger和web项目结合
Swagger在公司项目中如何应用
提供了很多学习资料。
Swagger入门教程
http://www.cnblogs.com/JoiT/p/6378086.html
简介:
提到了很多Swagger 的实现例子。