homepage.js/middleware/index.js

19 lines
417 B
JavaScript
Raw Normal View History

2023-02-19 03:32:25 +01:00
const express = require('express');
const router = express.Router();
const glob = require('glob');
glob(__dirname + "/**/*.js", {}, (er, data) => {
if (er) {
console.error(er);
process.exit(-1);
}
data
.filter(file => {
return !file.endsWith('index.js')
})
.forEach(file => {
require(file)(router);
});
});
module.exports = router;