-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
51 lines (42 loc) · 1.02 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
var Hapi = require('hapi');
// -- Setup --------------------------------------------------------------------
var server = new Hapi.Server();
server.connection({
port: process.env.PORT || 3000,
router: {
stripTrailingSlash: true
}
});
server.route(require('./routes'));
server.views({
engines: {
html: require('handlebars')
},
path: 'views',
helpersPath: 'views/helpers',
layoutPath: 'views/layout',
layout: 'default'
});
// -- Start --------------------------------------------------------------------
server.register({
register: require('good'),
options: {
reporters: [{
reporter: require('good-console'),
events: {
log: '*',
error: '*'
}
}]
}
}, function (err) {
if (err) {
throw err;
}
if (!module.parent) {
server.start(function () {
server.log('info', 'Server running at: ' + server.info.uri);
});
}
});
module.exports = server;