egg-swagger

1.2.2 • Public • Published

egg-swagger

NPM version build status Test coverage David deps Known Vulnerabilities npm download

egg plugin,support swagger-ui 2.0.

Install

$ npm i egg-swagger --save

Usage

// {app_root}/config/plugin.js
exports.swagger = {
  enable: true,
  package: 'egg-swagger',
};

Configuration

// {app_root}/config/config.default.js
exports.swagger = {
  enable: true,
  mountPath: '/test-mount', // swagger-ui  address  <domain>/test-mount
  swaggerFilePath: '/test-swagger.json', // swagger file default path
  enableGoogleFont: false,
};

see config/config.default.js for more detail.

Example

Tips

搭配 https://github.com/TheOne1006/egg-connector-remote 可直接生成对应的 swagger 数据

依赖说明

swagger.json 规则来自于 https://editor.swagger.io/?_ga=2.41951072.471192285.1510301833-940518916.1510301833#/

Questions & Suggestions

Please open an issue here.

License

MIT

Package Sidebar

Install

npm i egg-swagger

Weekly Downloads

109

Version

1.2.2

License

MIT

Unpacked Size

15.7 kB

Total Files

11

Last publish

Collaborators

  • theone1006