egg-swagger
egg-swagger copied to clipboard
swagger-ui plugin for egg ,Demo:
egg-swagger
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
- swagger-ui 对外开放 restful api
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