api/controllers/SwaggerController.js
const SwaggerController = {
doc(req, res) {
res.status(200).jsonx(sails.hooks.swagger.doc)
},
ui (req, res) {
let docUrl = req.protocol + '://' + req.get('Host') + '/swagger/doc'
res.redirect(sails.config.swagger.ui.url + '?doc=' + encodeURIComponent(docUrl))
}
}
export default SwaggerController