I am trying to render 2 different yaml specs in same server. I am using nested middleware but both context paths('/docs/emc' and '/docs/mysales') rendering same yaml.
index.js goes like this:
var fs = require('fs'),
path = require('path'),
http = require('http');
var app = require('connect')();
var swaggerTools = require('swagger-tools');
var jsyaml = require('js-yaml');
var serverPort = 8084;
var specEmc = fs.readFileSync(path.join(__dirname, 'api/swaggerEmc.yaml'), 'utf8');
var swaggerDocEmc = jsyaml.safeLoad(specEmc);
var specMySales = fs.readFileSync(path.join(__dirname, 'api/swaggerMySales.yaml'), 'utf8');
var swaggerDocMySales = jsyaml.safeLoad(specMySales);
const swaggerUiOptionsEmc = {
swaggerUi: '/docs/emc'
};
const swaggerUiOptionsMySales = {
swaggerUi: '/docs/mysales'
};
swaggerTools.initializeMiddleware(swaggerDocEmc, function (middlewareEmc) {
swaggerTools.initializeMiddleware(swaggerDocMySales, function (middlewareMySales) {
app.use(middlewareEmc.swaggerMetadata());
app.use(middlewareEmc.swaggerUi(swaggerUiOptionsEmc));
app.use(middlewareMySales.swaggerMetadata());
app.use(middlewareMySales.swaggerUi(swaggerUiOptionsMySales));
});
});
http.createServer(app).listen(serverPort, function () {
});
I am trying to render 2 different yaml specs in same server. I am using nested middleware but both context paths('/docs/emc' and '/docs/mysales') rendering same yaml.
index.js goes like this: