config.default.ts 配置设置
export = (appInfo: any) => {
const config: any = {};
// use for cookie sign key, should change to your own and keep security
config.keys = appInfo.name + '_1533201820393_3738';
config.swaggerdoc = {
dirScanner: './app/controller',
apiInfo: {
title: 'egg-example-api',
description: 'example for swaggerdoc',
version: '1.0.0',
},
schemes: ['http'],
enable: true,
routerMap: false, // 禁止自动注册路由, 否则会找不到注入对象
};
return config;
};
plugin.ts 插件引入
// 引入egg-swagger-doc插件
export const swaggerdoc = {
enable: true,
package: 'egg-swagger-doc',
};