-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreposerver.js
More file actions
42 lines (29 loc) · 1023 Bytes
/
reposerver.js
File metadata and controls
42 lines (29 loc) · 1023 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
39
40
41
var xmlrpc = require('xmlrpc')
var fs = require('fs')
// Creates an XML-RPC server to listen to XML-RPC method calls
var server = xmlrpc.createServer({ host: 'localhost', port: 9090 })
server.on('GetApprovedManifest', function (err, params, callback) {
console.log('Method call params for \'GetApprovedManifest\': ' + params)
fs.readFile('test.xml', function(err,data){
if(err) {
console.error("Could not open file: %s", err);
process.exit(1);
}
//console.log(data.toString());
// Send a method response with a value
callback(null, [1, data.toString()]);
});
})
server.on('GetManifest', function (err, params, callback) {
console.log('Method call params for \'GetManifest\': ' + params)
fs.readFile('test.xml', function(err,data){
if(err) {
console.error("Could not open file: %s", err);
process.exit(1);
}
//console.log(data.toString());
// Send a method response with a value
callback(null, [1, data.toString()]);
});
})
console.log('XML-RPC server listening on port 9090')