router.get('/', someObrabotchik);
router.get('/', moreSomeObrabotchik);
router.get('/', function(req, res, next) {...});
...
var fs = require('fs');
var path = require('path');
...
var loadRouters = function (dir){
var files = fs.readdirSync(dir);
files.forEach(fname=>{
const fpath = path.join(dir,fname);
if ( fs.statSync(fpath).isDirectory() ){
loadRouters(fpath);
}else if( fname === "main.js" ){
const router = require('./'+fpath);
app.use(dir, router);
}else{
}
});
};
loadRouters("./routers");
...