Update swagger-js with latest
* For the e2e tests to run, we had to enable CORS in http-server. The
release of http-server that supports CORS hasn't come out yet so we
have to use http-server@master until then. Here is the commit I speak
of: 30f4d1e008
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Swagger UI and Specs Servers
|
||||
*/
|
||||
var path = require('path')
|
||||
var path = require('path');
|
||||
var createServer = require('http-server').createServer;
|
||||
|
||||
var dist = path.join(__dirname, '..', '..', 'dist');
|
||||
@@ -11,22 +11,17 @@ var SPEC_SERVER_PORT = 8081;
|
||||
|
||||
var driver = require('./driver');
|
||||
|
||||
var headers = {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept'
|
||||
};
|
||||
|
||||
var swaggerUI;
|
||||
var specServer;
|
||||
|
||||
module.exports.start = function (specsLocation, done) {
|
||||
swaggerUI = createServer({ root: dist, headers: headers });
|
||||
specServer = createServer({ root: specs, headers: headers });
|
||||
swaggerUI = createServer({ root: dist, cors: true });
|
||||
specServer = createServer({ root: specs, cors: true });
|
||||
|
||||
swaggerUI.listen(DOCS_PORT);
|
||||
specServer.listen(SPEC_SERVER_PORT);
|
||||
|
||||
var swaggerSpecLocation = encodeURIComponent('http://localhost:' + SPEC_SERVER_PORT + specsLocation)
|
||||
var swaggerSpecLocation = encodeURIComponent('http://localhost:' + SPEC_SERVER_PORT + specsLocation);
|
||||
var url = 'http://localhost:' + DOCS_PORT + '/index.html?url=' + swaggerSpecLocation;
|
||||
|
||||
setTimeout(function(){
|
||||
@@ -35,7 +30,7 @@ module.exports.start = function (specsLocation, done) {
|
||||
}, process.env.TRAVIS ? 20000 : 3000);
|
||||
};
|
||||
|
||||
module.exports.close = function(){
|
||||
module.exports.close = function() {
|
||||
swaggerUI.close();
|
||||
specServer.close();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user