forked from AMPATH/remote-sync-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
33 lines (28 loc) · 748 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
(function() {
'use strict';
const Hapi = require('hapi');
const serverConfigs = require('./config');
const updates = require('./update.service');
const server = new Hapi.Server();
server.connection({
host: serverConfigs.host || 'localhost',
port: serverConfigs.port || 8000,
});
server.route({
method: 'GET',
path: '/',
handler: function(request, reply) {
return reply('<h2>Karibu sana, kurasa iko kwenye matengenezo!</h2>');
}
});
server.start((err) => {
if(err) {
throw err;
}
var task = updates.scheduleUpdates(serverConfigs.updateSchedule);
if(task) {
task.start();
}
console.log('Kick as* server running at: ', server.info.uri);
})
})();