Closed dengdan99 closed 3 years ago
i can't found some configuration about close or disenable this
os, i do like this
const isPordMode = process.env.NODE_ENV == "production" let protectedRouter: Router | SwaggerRouter if (isPordMode) { protectedRouter = new Router() } else { protectedRouter = new SwaggerRouter() } protectedRouter.get('/managers', master.getMasters) protectedRouter.post('/manager', master.createMaster) protectedRouter.get('/managers/:id', master.getMaster) if (protectedRouter instanceof SwaggerRouter) { protectedRouter.swagger({ title: '接口文档', description: '描述', version: '1.2.3' }) protectedRouter.mapDir(path.resolve(__dirname, '../controllers/')) } export { protectedRouter }
if (!isProdMode) { router.swagger(...) }
swagger endpoint is registered to router by calling router.swagger(...), so if you want to disable it , you can just call router.swagger in develop mode.
ok done 谢谢
i can't found some configuration about close or disenable this
os, i do like this