-
Notifications
You must be signed in to change notification settings - Fork 0
/
container.js
36 lines (29 loc) · 1.05 KB
/
container.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
//щоб не використовувати багато разів require одного і того самого,
// створимо контейнер, де додамо залежності завдяки dependable
const dependable = require('dependable');
const path = require('path');
const container = dependable.container();
const simpleDependencies = [
['_','lodash'],
['passport', 'passport'],
['validator', 'express-validator'],
['formidable', 'formidable'],
['Club', './models/clubs'],
['async', 'async'],
['aws', './helpers/AWSUpload'],
['Users', './models/user'],
['Message', './models/message'],
['Group', './models/groupmessage']
];
simpleDependencies.forEach(function (val){
container.register(val[0], function (){
return require(val[1]);
})
});
//замість const _ = require('lodash');
container.load(path.join(__dirname, '/controllers'));
container.load(path.join(__dirname, '/helpers'));
container.register('container', function (){
return container;
});
module.exports = container;