I am deploying from two different servers, so how can I dynamically set the url in index.html? The documentation is static served from a Node.js server.
Node.js code
-------------
if (isThisServer) {
urlFromNode = '/this';
} else {
urlFromNode = '/that';
}
index.html
-------------
var swaggerUi = new SwaggerUi({
url: urlFromNode,
});
swaggerUi.load();
Any suggestions? In every example I've just seen the url hardcoded. I'd rather not go through the hassle of setting up templating. I figure there would be an easier way to do this.
Don't know if this helps, but you can pass the url parameter to the index.html itself (like http://petstore.swagger.io?url=http://..../swagger.json. Otherwise, at least for now, I can't think of another way besides your own solution but others may have ideas.
Pass the ?url=http://petstore.swagger.io/v2/swagger.json or dynamically generate the index.html inside your app.
Most helpful comment
Don't know if this helps, but you can pass the
urlparameter to the index.html itself (likehttp://petstore.swagger.io?url=http://..../swagger.json. Otherwise, at least for now, I can't think of another way besides your own solution but others may have ideas.