https://github.com/jiaxiaolei/swagger-editor.git
簡(jiǎn)介:
swagger 在github 上有倉(cāng)庫(kù)。這里是我fork的一個(gè)地址祥绞。
使用實(shí)例:
- 基礎(chǔ)環(huán)境
$ 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安裝成功。
- 啟動(dòng)項(xiàng)目
$ 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
image.png
擴(kuò)展閱讀:
Swagger
http://www.reibang.com/p/4115f2b53983
簡(jiǎn)介:
swagger學(xué)習(xí)
Swagger定義
Swagger同類工具
Swagger和web項(xiàng)目結(jié)合
Swagger在公司項(xiàng)目中如何應(yīng)用
提供了很多學(xué)習(xí)資料析桥。
Swagger入門教程
http://www.cnblogs.com/JoiT/p/6378086.html
簡(jiǎn)介:
提到了很多Swagger 的實(shí)現(xiàn)例子司草。