manually load middleware
This commit is contained in:
parent
15d229704e
commit
6af483ece5
|
@ -2,18 +2,7 @@ const express = require('express');
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
const glob = require('glob');
|
const glob = require('glob');
|
||||||
|
|
||||||
glob(__dirname + "/**/*.js", {}, (er, data) => {
|
router.use(require('./session'));
|
||||||
if (er) {
|
router.use(require('./session_back'));
|
||||||
console.error(er);
|
|
||||||
process.exit(-1);
|
|
||||||
}
|
|
||||||
data
|
|
||||||
.filter(file => {
|
|
||||||
return !file.endsWith('index.js')
|
|
||||||
})
|
|
||||||
.forEach(file => {
|
|
||||||
require(file)(router);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
|
@ -0,0 +1 @@
|
||||||
|
module.exports = (router) => {}
|
Loading…
Reference in New Issue