-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhpp-service.js
36 lines (33 loc) · 953 Bytes
/
hpp-service.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
/**
* @name Hot Potato service
* @summary Hydra Express service entry point
* @description plays the hot potato game
*/
'use strict';
const version = require('./package.json').version;
const hydraExpress = require('hydra-express');
const hydra = hydraExpress.getHydra();
const player = require('./hot-potato-player');
let config = require('fwsp-config');
/**
* Load configuration file and initialize hydraExpress app.
*/
config.init('./config/config.json')
.then(() => {
config.version = version;
hydraExpress.init(config.getObject(), version, () => {
hydraExpress.registerRoutes({
'/v1/hpp': require('./routes/hpp-v1-routes')
});
})
.then((serviceInfo) => {
console.log('serviceInfo', serviceInfo);
player.init();
hydra.on('message', (message) => {
player.messageHandler(message);
});
})
.catch((err) => {
console.log('err', err);
});
});