Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const fs = require('fs');
- function autoload(route_path, app) {
- fs.readdirSync(route_path).forEach(function(file) {
- var filepath = route_path + '/' + file;
- fs.stat(filepath, function(err,stat) {
- if (stat.isDirectory()) {
- autoload(filepath, app);
- } else {
- require(filepath)(app);
- }
- });
- });
- }
- module.exports = autoload
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement