-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhmr-svcs.js
More file actions
38 lines (33 loc) · 998 Bytes
/
hmr-svcs.js
File metadata and controls
38 lines (33 loc) · 998 Bytes
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
/**
* @name hmr-svcs
* @summary Hydra Express service entry point
* @description Hydra Message Relay Service
*/
'use strict';
const hydraExpress = require('hydra-express');
const hydra = hydraExpress.getHydra();
let main = async() => {
try {
let serviceInfo = await hydraExpress.init(`${__dirname}/config/config.json`, () => {
hydraExpress.registerRoutes({
'/v1/hmr': require('./routes/hmr-v1-routes')
});
});
let serviceName = hydra.getServiceName();
let instanceVersion = hydra.getInstanceVersion();
let instanceID = hydra.getInstanceID();
let logEntry = `Started ${serviceName} (v.${instanceVersion})`;
console.log(logEntry);
console.log(serviceInfo);
hydra.on('message', (message) => {
hydra.sendReplyMessage(message, {
bdy: {
message: `Message reply to mid (${message.mid}) by ${serviceName} instance ${instanceID}`
}
});
});
} catch (err) {
console.log('err', err);
}
};
main();