Adds middleware to your express app to serve the Swagger UI bound to your Swagger document. This acts as living documentation for your API hosted from within your app.
MIT License
1.43k
stars
228
forks
source link
How to serve SwaggerUI without using middleware (app.use) #315
I'm implementing a controller where I'm only responsible of the get route/function and don't have access to app.
const swaggerUI = require('swagger-ui');
function getSwagger(req, res) {
//swaggerUI.serve?
//swaggerUI.serveFile?
var page = swaggerUI.generateHTML(doc);
return res.send(page);
}
This isn't working with error 404. how do I call serve correctly in the function?
P.S.: this is a pseudo code, because I don't have access to my pc at the moment, but the idea is I don't have access to app.use and app.get, I only can implement inside of the get function.
I'm implementing a controller where I'm only responsible of the get route/function and don't have access to app.
This isn't working with error 404. how do I call serve correctly in the function?
P.S.: this is a pseudo code, because I don't have access to my pc at the moment, but the idea is I don't have access to app.use and app.get, I only can implement inside of the get function.