egg-swagger-static
v0.1.2
Published
A simple plugin for swagger static doc.
Downloads
10
Maintainers
Readme
egg-swagger-static
Install
$ npm i egg-swagger-static --save
Usage
// {app_root}/config/plugin.js
exports.swaggerStatic = {
enable: true,
package: 'egg-swagger-static',
};
Configuration
// {app_root}/config/config.default.js
const swaggerPath = require('egg-swagger-static').getAbsoluteFSPath();
// exports.swaggerStatic = {
// NOT USE.
// };
// Add config of the built-in plugin: egg-static
config.static = {
maxAge: 31536000,
// prefix: '/swg',
// dir: swaggerPath,
dir: [
// swaggerPath,
{
prefix: '/swg',
dir: swaggerPath
},
],
};
Add Api docs with the specification of OpenAPI
Refer to template: swagger.yml.
Add api.yml or api.json in the root dir of project.
Visit Api Page
Api Page: http://[SERVRT_IP]:[SERVRT_PORT]/swg/index.html
see config/config.default.js for more detail.
see egg-static for more detail.
see swagger-ui/dist for more detail.
see OpenAPI for more detail.
Example
Questions & Suggestions
Please open an issue here.