-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
60 lines (48 loc) · 1.34 KB
/
server.js
File metadata and controls
60 lines (48 loc) · 1.34 KB
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
'use strict';
const Path = require('path');
var Glue = require('glue');
var Config = require('./config/appConfig');
require('console-stamp')(console, { pattern : "dd/m/yyyy HH:MM:ss" } );
Config.server.service.uri =
(Config.server.service.tls ? 'https://' : 'http://') +
Config.server.service.host + ':' +
Config.server.service.port;
var manifest = {
server: {
app: {
config: Config
}
},
connections: [
{
host: Config.server.service.host,
port: Config.server.service.port,
labels: Config.product.name,
routes: {
cors: true,
validate: {
options: {
abortEarly: false
}
}
}
}
],
plugins: {
'../lib': [{ select: 'node-hapi-mysql' }]
}
};
module.exports = manifest;
if (!module.parent) {
Glue.compose(manifest, { relativeTo: Path.join(__dirname, 'node_modules') }, function (err, server) {
if ( err ) {
console.error( err );
}
server.start(function () {
if ( err ) {
console.error( err );
}
console.log(Config.product.name+ ' started on ' + Config.server.service.uri);
});
});
}