Skip to content

Commit

Permalink
This doesn’t work with latest swagger UI. Also, people should be enco…
Browse files Browse the repository at this point in the history
…uraged to update and build the swagger UI from source instead of relying on swagger-express to modify the default discovery URL.
  • Loading branch information
calmdev committed Dec 12, 2013
1 parent cf31676 commit da8bbc1
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions lib/swagger-express/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,23 +176,6 @@ exports.init = function (app, opt) {
// Serve up swagger ui at /swagger via static route
var swHandler = express['static'](opt.swaggerUI);

// Overwrite swagger-ui discoveryUrl base on basePath
fs.readFile(opt.swaggerUI + '/index.html', function (err, data) {
if (err) {
return err;
}

var html = data.toString();
var regex = /discoveryUrl:(.*?),/;

html = html.replace(regex, 'discoveryUrl: "' + opt.basePath + '/api-docs.json",');

fs.writeFile(opt.swaggerUI + '/index.html', html, function (err) {
if (err) {
throw err;
}
});
});
// Serve up swagger ui interface.
var swaggerURL = new RegExp('^'+ opt.swaggerURL +'(\/.*)?$');

Expand Down

0 comments on commit da8bbc1

Please sign in to comment.