/
start-server.js
74 lines (44 loc) · 1.32 KB
/
start-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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
module.exports = {
friendlyName: 'Start server',
description: 'Machine used to start an instance of a jxm server',
cacheable: false,
sync: false,
inputs: {
serviceName: {
example: 'Hello World',
description: 'The name of our service',
required: true
},
baseUrlPath: {
example: '/helloworld',
description: 'The base url path of our service. If none is provided, inferred from serviceName',
required: false
},
},
exits: {
success: {
friendlyName: 'Server Started',
description: 'Server successfully started',
example: 'ok!',
},
},
fn: function(inputs, exits
/**/
) {
var server = require('jxm');
var _ = require('lodash');
var baseUrlPath = null;
if (_.isUndefined(inputs.baseUrlPath)){
baseUrlPath = '/'.concat(inputs.serviceName);
} else {
baseUrlPath = inputs.baseUrlPath;
}
server.setApplication(inputs.serviceName, baseUrlPath, "NUBISA-STANDARD-KEY-CHANGE-THIS");
server.addJSMethod("serverMethod", function (env, params) {
console.log('received :'.concat(params));
server.sendCallBack(env, 'Simon Says : '.concat(params));
});
server.start();
return exits.success('server started!');
},
};