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.
18 lines
583 B
18 lines
583 B
'use strict';
|
|
|
|
const path = require('path');
|
|
const fs = require('fs');
|
|
|
|
module.exports = function (app, router, opts) {
|
|
fs.readdirSync(__dirname).forEach((filename) => {
|
|
if (filename.indexOf('.') !== 0 && fs.lstatSync(path.join(__dirname, filename)).isDirectory()) {
|
|
fs.readdirSync(path.join(__dirname, filename)).forEach((api) => {
|
|
if (api.indexOf('.') == 0 || api.indexOf('.js') == -1) return;
|
|
require(`./${filename}/${api}`)(app, router, opts);
|
|
console.log(111,filename,api);
|
|
});
|
|
}
|
|
});
|
|
|
|
return router;
|
|
};
|
|
|