安裝 Mongo並啟動
安裝yapi-cli
npm install -g yapi-cli
啟動
yapi server
瀏覽器打開
- 問題1:初始化數據庫報錯
Error: (node:90198) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
解決方法
cd ~/my-yapi/vendors
vim exts/server/utils.js 22行 添加 useUnifiedTopology: true
let options = {useNewUrlParser: true, useCreateIndex: true, useUnifiedTopology: true};
參考官網的命令行部署方式 https://hellosean1025.github.io/yapi/devops/index.html
npm run install-server
- 問題2:初始化管理員賬號失敗
解決方法:刪除mongodb數據庫中已創建的管理員數據,重新運行
Mac OS可以使用 NoSQL Booster客戶端連接Mongodb,如下圖:
初始化管理員賬號成功,賬號名:"superhin@126.com",密碼:"ymfe.org"
啟動服務
cd ~/my-yapi
node vendors/server/app.js
訪問網站
http://127.0.0.1:3000/ 使用賬號 密碼登錄即可
官方使用教程:https://hellosean1025.github.io/yapi/
接口請求插件安裝
- 點擊[點擊下載]連接,解壓下載的crossRequest.zip得到cross-request.crx
- 修改cross-request.crx后綴名為.rar,解壓后得到cross-request目錄
- 瀏覽器打開chrome://extensions/,打開開發者模式,點擊 加載已解壓的擴展程序,選擇cross-request目錄即可