-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathserver.js
51 lines (47 loc) · 1.16 KB
/
server.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
/**
* Dependencies.
*/
var Hapi = require('hapi');
// Create a new server
var server = new Hapi.Server();
// Setup the server with a host and port
server.connection({
port: parseInt(process.env.PORT, 10) || 3000,
host: '0.0.0.0',
router: {
stripTrailingSlash: true
}
});
// Export the server to be required elsewhere.
module.exports = server;
/*
Load all plugins and then start the server.
First: community/npm plugins are loaded
Second: project specific plugins are loaded
*/
server.register([
{
register: require("good"),
options: {
reporters: [{
reporter: require('good-console'),
events: { ops: '*', request: '*', log: '*', response: '*', 'error': '*' }
}]
}
},
{
register: require('./server/auth/index.js')
},
{
register: require('./server/example/index.js')
},
{
register: require('./server/base/index.js')
}
], function () {
//Start the server
server.start(function() {
//Log to the console the host and port info
console.log('Server started at: ' + server.info.uri);
});
});