运维服务中台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
640 B

1 year ago
/**
* Created by liu.xinyi
* on 2016/7/7.
*/
const path = require('path');
const fs = require('fs');
module.exports = {
entry(app, router, opts) {
fs.readdirSync(__dirname).forEach((dir) => {
if (dir.indexOf('.') !== 0 && fs.lstatSync(path.join(__dirname, dir)).isDirectory()) {
fs.readdirSync(path.join(__dirname, dir)).forEach((api) => {
if (api.indexOf('.') == 0 || api.indexOf('.js') == -1) return;
require(`./${dir}/${api}`).entry(app, router, opts);
app.fs.logger.log('info', '[Router]', 'Inject api:', `${dir}/${path.basename(api, '.js')}`);
});
}
});
},
};