-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathserver.js
52 lines (47 loc) · 947 Bytes
/
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
52
var Hapi = require('hapi')
var Good = require('good')
// create new server instance
var server = new Hapi.Server()
// add server’s connection information
server.connection({
host: 'localhost',
port: 3000
})
// register plugins to server instance
server.register([
{
register: require('./base-route')
},
{
register: Good,
options: {
ops: {
interval: 10000
},
reporters: {
console: [
{
module: 'good-squeeze',
name: 'Squeeze',
args: [ { log: '*', response: '*', request: '*' } ]
},
{
module: 'good-console'
},
'stdout'
]
}
}
}
], function (err) {
if (err) {
throw err
}
// start your server after plugin registration
server.start(function (err) {
if (err) {
throw err
}
server.log('info', 'Server running at: ' + server.info.uri)
})
})