我正在嘗試在VM/Vagrant框中設置Swagger。我所做的是以下。無法在瀏覽器中打開Swagger API
i。 端口轉發使用Vagrantfile
dev.vm.network "forwarded_port", guest: 3000, host: 3000, host_ip:
"127.0.0.1", auto_correct: true
II。在顛沛流離的盒子
npm install -g swagger
Create a new swagger project
swagger project create hello-world
揚鞭配置我試圖打開揚鞭編輯器與命令swagger project edit -p 3000 -s
,這給
開始揚鞭編輯器。運行Swagger Editor API服務器。您可以 使GET和PUT調用http://127.0.0.1:3000/editor/spec
好像一切都是本地桌面(Windows)的完美的,所以剛剛訪問了瀏覽器,並訪問了http://localhost:3000/editor/spec
這給了我這個網站不能達到。
curl http://localhost:3000/editor/spec在虛擬機/流浪箱中工作正常。
我在這裏做什麼錯?
是的,它現在正在工作,但不像一些文本打開實際的編輯器。你知道爲什麼嗎? – Deamon
你的意思是「就像一些文字」 - 你沒有得到https://github.com/swagger-api/swagger-node/blob/master/docs/cli.md#swagger-project-edit-options-目錄 ?也許你應該創建新的問題的細節和實際與預期的結果 –
你可以請看看它在這裏(https://stackoverflow.com/questions/45005086/swagger-editor-isnt-opening-in-chrome-version -59-0-3071-115官方建造-6)?在Windows中同樣的事情工作得很好。我的意思是,我可以看到那裏顯示的確切窗口。但是使用流浪者的虛擬機設置有什麼問題? – Deamon