I've got a lot of folders as modules that contains my rest api, the structure is the following:
app
|— server
| |— rest-api
| | |— v1
| | | |— module-one
| | | |— module-two
| | | |— module-three
| | | |— module-x
| | | └── index.js
| | └──...
| └──...
|— ...
└── server.js
What I want to avoid at v1/index.js
is the following:
module.exports = (function () {
var express = require( 'express' ),
router = express.Router(),
module_one = require( './module-one' ),
module_two = require( './module-two' ),
module_three = require( './module-three' );
//...
router.use( module_one );
router.use( module_two );
router.use( module_three );
//...
return router;
})();
Is there a way to read all them at once?