DefinitelyTyped/xmlrpc/xmlrpc-tests.ts
Andy d2150a603f Even more 2.0 (#12503)
* Always use forceConsistentCasingInFileNames

* Rename files

* Convert more packages to `types-2.0` style
2016-11-05 13:34:11 -07:00

27 lines
556 B
TypeScript

import * as xmlrpc from 'xmlrpc';
const serverOpts = {
host: 'localhost',
port: 9000
};
const server = xmlrpc.createServer(serverOpts, () => {
server.on('NotFound', method => {
console.log(`Method ${method} not found`);
})
server.on('hello', (err, params, cb) => {
cb(null, `Hello, ${params[0]}!`);
});
var client = xmlrpc.createClient({
host: 'localhost',
port: 9000,
path: '/'
});
client.methodCall('hello', ['world'], (err, val) => {
console.log(val);
});
});