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.
here solution found here (pretty quick , painless if have node installed):
with node, globally install package http-server
npm install -g http-server
change directories json located, , run command
http-server --cors
(cors has enabled work)open swagger ui (i.e. dist/index.html)
type http://localhost:8080/my.json in input field , click "explore"
Comments
Post a Comment