Skip to content

Instantly share code, notes, and snippets.

@maumercado
Created December 6, 2017 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maumercado/b9e897d70ba81eb04a13c818f41cc611 to your computer and use it in GitHub Desktop.
Save maumercado/b9e897d70ba81eb04a13c818f41cc611 to your computer and use it in GitHub Desktop.
// inside Vx level index
// files are named yyy_controller/routes/whatev.js
const fs = require("fs");
const controllers = {};
fs
.readdirSync(__dirname)
.filter(file => file !== "index.js")
.forEach(file => {
controllers[file.split("_")[0]] = require(`./${file}`);
});
module.exports = controllers;
// Vx level index
const fs = require("fs");
const controllers = {};
fs
.readdirSync(__dirname)
.filter(file => file !== "index.js")
.forEach(file => {
controllers[file] = require(`./${file}`);
});
module.exports = controllers;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment