fscher
5 years agoOccasional Visitor
Node server stub overrides my existing routes
Hello there!
I have the following scenario:
- Existing Node + Express app.
- Existing routes in place.
- Integrating the auto-generated Node stub for my API.
I have modified the startup code to merge it with my existing Express app:
// Swagger stuff *********************************** var oas3Tools = require('oas3-tools'); // swaggerRouter configuration var options = { controllers: path.join(__dirname, './API/controllers'), }; var expressAppConfig = oas3Tools.expressAppConfig(path.join(__dirname, './API/api/openapi.yaml'), options); // expressAppConfig.addValidator(); const app = expressAppConfig.getApp(); const CONSTANTS = require('./CONSTANTS.js'); const initializer = require('./initializer.js'); const utils = require('./utils/utils.js'); // Start up stuff *********************************** // const app = express(); const http = require('http').createServer(app);
Then, my old routes stopped working!
It seems to be either serving the API or my old routes, depending on commenting / uncommenting this line:
// expressAppConfig.addValidator();
Is there a way to have both routes served from the same app?
Thanks in advance for your support!