/** * 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')}`); }); } }); }, };