How to use local json file in swagger-ui documentation -


i trying use local swagger.json file displayed in swagger documentation.

my swagger.json file under /home/user1/swagger-ui/dist/swagger.json , index.html resides under same directory. have modified index.html below.

 window.swaggerui = new swaggerui({     spec: ../swagger.json     url: url,     dom_id: "swagger-ui-container", 

after starting docker instance using docker run -p 80:8080 swagger-ui-builder, accessing http://192.168.xx.xx/ not display documentation. attaching screenshot reference. please me resolve this.enter image description here

here solution found here (pretty quick , painless if have node installed):

  1. with node, globally install package http-server npm install -g http-server

  2. change directories json located, , run command http-server --cors (cors has enabled work)

  3. open swagger ui (i.e. dist/index.html)

  4. type http://localhost:8080/my.json in input field , click "explore"


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -