-
Notifications
You must be signed in to change notification settings - Fork 77
/
app.js
44 lines (43 loc) · 1009 Bytes
/
app.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
/**
* Startup NEI Server
*/
exports.start = function (options) {
let opt = {
port: 8082,
mode: 'develop',
};
Object.assign(opt, options);
opt.source = opt.mode === 'develop';
// init config
process.appConfig = Object.assign(
{
appRoot: __dirname,
webRoot: '/public/'
},
require(`./server/config/${opt.mode}.js`),
{
mode: opt.mode
}
);
// create a server
let app = new (require('./server/arch/NServer'))({
port: opt.port,
view: {
resolver: 'EJSResolver'
},
roots: {
'appRoot': __dirname,
'webRoot': '/public/',
'viewRoot': opt.source ? '/view/' : '/template/',
'webPath': '/server/controller/web/',
'apiPath': '/server/controller/api/',
'filterPath': '/server/filter/',
'uploadRoot': './uploads',
'downloadRoot': './downloads'
},
routes: require('./server/config/router'),
filters: require('./server/config/filter')
});
// start up server
app.start();
};