Skip to content

Commit 7ecc6a1

Browse files
committed
:feat: fix some bugs
1 parent 9399fc7 commit 7ecc6a1

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ module.exports = function(app) {
9191

9292
### 开启 swagger
9393

94-
配置 `.env` 文件,开启 Swagger
94+
配置 `.env` 文件,开启 Swagger,只支持 `src/**/*.js` 目录下文件
9595

9696
```conf
9797
DOCS_SWAGGER=true

src/plugins/docs/swagger.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function swaggerOptionsFactory(spec, config) {
2424
// basePath: '/', // Base path (optional)
2525
},
2626
// Path to the API docs
27-
apis: [ path.resolve(root, '**/*.js'), path.resolve(__dirname, '**/*.js') ],
27+
apis: [ path.resolve(root, 'src/**/*.js'), path.resolve(__dirname, '**/*.js') ],
2828
};
2929
}
3030
return {

src/plugins/factory/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ module.exports = async function(api, info = {}) {
3636
return reject(err);
3737
}
3838
resolve({ host: _host, port: _port, url: `http://${_host}:${_port}` });
39+
40+
if (process.env.DOCS_SWAGGER) {
41+
logger.info('[Swagger UI]', `http://${_host}:${_port}/api/docs/swagger`);
42+
}
3943
});
4044
});
4145
};

0 commit comments

Comments
 (0)