Skip to content

Commit da8bbc1

Browse files
committed
This doesn’t work with latest swagger UI. Also, people should be encouraged to update and build the swagger UI from source instead of relying on swagger-express to modify the default discovery URL.
1 parent cf31676 commit da8bbc1

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

lib/swagger-express/index.js

-17
Original file line numberDiff line numberDiff line change
@@ -176,23 +176,6 @@ exports.init = function (app, opt) {
176176
// Serve up swagger ui at /swagger via static route
177177
var swHandler = express['static'](opt.swaggerUI);
178178

179-
// Overwrite swagger-ui discoveryUrl base on basePath
180-
fs.readFile(opt.swaggerUI + '/index.html', function (err, data) {
181-
if (err) {
182-
return err;
183-
}
184-
185-
var html = data.toString();
186-
var regex = /discoveryUrl:(.*?),/;
187-
188-
html = html.replace(regex, 'discoveryUrl: "' + opt.basePath + '/api-docs.json",');
189-
190-
fs.writeFile(opt.swaggerUI + '/index.html', html, function (err) {
191-
if (err) {
192-
throw err;
193-
}
194-
});
195-
});
196179
// Serve up swagger ui interface.
197180
var swaggerURL = new RegExp('^'+ opt.swaggerURL +'(\/.*)?$');
198181

0 commit comments

Comments
 (0)