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
The custom routes are not longer working with the latest update
'use strict';varpath=require('path');varhttp=require('http');varoas3Tools=require('oas3-tools');varserverPort=8080;// swaggerRouter configurationvaroptions={routing: {controllers: path.join(__dirname,'./controllers')},};varexpressAppConfig=oas3Tools.expressAppConfig(path.join(__dirname,'api/openapi.yaml'),options);varapp=expressAppConfig.getApp();/** THIS CUSTOM ROUTE IS NOT LONGER ACCESSIBLE **/app.get('/foo',(req,res)=>{res.send('foo')})// Initialize the Swagger middlewarehttp.createServer(app).listen(serverPort,function(){console.log('Your server is listening on port %d (http://localhost:%d)',serverPort,serverPort);console.log('Swagger-ui is available on http://localhost:%d/docs',serverPort);});
The text was updated successfully, but these errors were encountered:
Some hacky code to get this to work, till the fix is out
Take the middlewares (4) you added and insert it into the 5th position(arbitrary - you can try any position before router, and after express json middlewares)
const stack = app._router.stack;
const lastEntries = stack.splice(app._router.stack.length - 4); // The number of middle ware you added 4 in this case.
const firstEntries = stack.splice(0, 5); // Arbitary number 5, adding our middleware after the first 5
app._router.stack = [...firstEntries, ...lastEntries, ...stack];
console.log(app._router.stack);
The custom routes are not longer working with the latest update
The text was updated successfully, but these errors were encountered: