swagger for Mac install local

swagger for Mac install

1、去node官網下載node.js

2、git clone https://github.com/swagger-api/swagger-editor/releases

3、npm install -g http-server

4、啓動Swagger-Editor項目

http-server swagger-editor 以8080端口啓動項目

http-server –p 8082 swagger-editor 指定端口啓動項目

http-server -p 8081 swagger-editor-3.0.17

5、git clone https://github.com/swagger-api/swagger-ui.git

6、安裝express

mkdir node_app

cd node_app

npm init
(可自行填寫)

npm install express --save

vi index.js

var express = require('express');
var app = express();
app.use('/static', express.static('public'));
app.get('/', function (req, res) {
  res.send('Hello World!');
});

app.listen(3000, function () {
  console.log('Example app listening on port 3000!');
});

mkdir pubilc

cd public

cp swagger-ui/dist/* (當前文件夾public)

node …/index.js

報錯:Error: Cannot find module 'express'

到當前項目目錄下執行命令:

npm link express

修改index.html中的js代碼的url路徑/static/test.json

swagger學習:https://blog.csdn.net/xiang__liu/article/details/80396642
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章