midwayjsでegg-swagger-docを使用する


目次
  • config.default.ts構成設定
  • plugin.tsプラグイン導入
  • 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',
    };
    

    コードサンプルアドレス