ghettosamson
4 years agoOccasional Visitor
Putting swagger ui endpoint behind express authentication middleware
I have a single page MEAN web application and I'm using the swagger-ui-express npm module. Our project wants to put the api-docs endpoint behind authentication middleware, so you can only access the route if you are logged in. Currently this is how we add the swagger endpoint
router.use('/api-docs', swaggerUi.serve, swaggerUi.setup(null, options));
Is it possible to protect this route and make it use the same authentication middleware, or is this not possible?