-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
78 lines (67 loc) · 1.84 KB
/
index.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Using STRICT mode for ES6 features
"use strict";
/**
* Requiring Core Library
*
* WARNING: Core modules MUST be included from TOP Level Module.
* All dependencies for core module must be excluded from the package.json
*/
var DioscouriCore = process.mainModule.require('dioscouri-core');
/**
* Loader class for the model
*/
class Loader extends DioscouriCore.AppBootstrap {
/**
* Model loader constructor
*/
constructor () {
// We must call super() in child class to have access to 'this' in a constructor
super();
/**
* Module name/version
*
* @type {null}
* @private
*/
this._moduleName = 'Simple NodeJS Module';
this._moduleVersion = '0.3.4';
}
/**
* Initializing module configuration
*/
init () {
super.init();
// Loading module routes
this.applicationFacade.server.loadRoutes('/app/routes', __dirname);
// Loading models
this.applicationFacade.loadModels(__dirname + '/app/models');
// Checking Symbolic links
var fs = require('fs');
try {
if (!fs.existsSync(DioscouriCore.ApplicationFacade.instance.basePath + '/public/nms')) {
fs.symlinkSync(DioscouriCore.ApplicationFacade.instance.basePath + '/public/nms', __dirname + '/app/public', 'dir');
}
} catch (error) {
console.error('ERROR: Failed to create symbolic links');
console.error(error.message);
}
}
/**
* Bootstrapping module
*
* MongoDB is available on this stage
*/
bootstrap () {
super.bootstrap();
};
/**
* Run module based on configuration settings
*/
run () {
super.run();
};
}
/**
* Exporting module classes and methods
*/
module.exports = Loader;