-
Notifications
You must be signed in to change notification settings - Fork 0
/
elegance.js
42 lines (25 loc) · 877 Bytes
/
elegance.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* Created by byoelin on 8/22/2016.
*/
module.exports = new Elegance;
var camelCase = require('camelcase');
var fs = require("fs");
function Elegance() {
/*
create an array of module folders. in this instance we used
the folders 'modules' and 'objects'.
*/
this.initModules = function(arrayModules){
var _ = require("underscore");
_.each(arrayModules, function(moduleDir){
var fileNames = fs.readdirSync("./"+moduleDir);
_.each(fileNames, function(fileName){
fileName = fileName.replace(/.js/,'');
eval("GLOBAL."+fileName+" = require('./" +moduleDir+"/"+fileName+"');");
})
})
};
this.initialize = function(express, arrayModules, arrayRoutes){
this.initModules(arrayModules);
};
}