mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Always use forceConsistentCasingInFileNames * Rename files * Convert more packages to `types-2.0` style
27 lines
556 B
TypeScript
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);
|
|
});
|
|
});
|