You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.
See Issue #19. The short answer is, yes, it's possible. The longer answer is that it's not quite as straightforward or easy as it should be, so I plan to make this easier in the future
@BigstickCarpet Actually, I have tried the #1 solution in Issue #19 but failed... I've also tried to do it with the sample in the Node's cluster feature. The following is my codes:
// Set the DEBUG environment variable to enable debug output
process.env.DEBUG = 'swagger:*';
process.chdir(__dirname);
// Create a Swagger Server app from the PetStore.yaml file
var swaggerServer = require('swagger-server');
var arr = ["../swagger.json","../swagger-petstore.json"]
var cluster = require('cluster');
if (cluster.isMaster) {
console.log('[master] ' + "start master...");
for (var i = 0; i < arr.length; i++) {
cluster.fork({"index":i});
}
cluster.on('listening', function (worker, address) {
console.log('[master] ' + 'listening: worker' + worker.id + ',pid:' + worker.process.pid + ', Address:' + address.address + ":" + address.port);
});
cluster.on('fork',function (worker){
// timeouts[worker.id] = setTimeout(errorMsg, 2000);
});
} else if (cluster.isWorker) {
var id = cluster.worker.id;
var content = arr[id-1]
console.log('[worker] ' + "start worker ..." + id+", index:"+cluster.worker.index+", content:"+content);
var app = swaggerServer(content);
// Start listening on port 8000
app.listen(8001, function() {
console.log('The Swagger Pet Store is now running at http://localhost:8000');
})
}
In this case, neither of the two swagger files can work... Is there anything wrong I configured?
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In swagger server, I need to parse multiple swaggers (2.0) at one time, is it possible to achieve or is there any way I can implement locally?
The text was updated successfully, but these errors were encountered: