Hello World
首先让我们从 Hello World 开始。
服务器
var hprose = require("hprose");
function hello(name) {
return "Hello " + name + "!";
}
var server = hprose.Server.create("http://0.0.0.0:8080");
server.addFunction(hello);
server.start();
启动服务器:
node server.js
客户端
var hprose = require("hprose");
var client = hprose.Client.create("http://127.0.0.1:8080/", ['hello']);
client.hello("world", function(result) {
console.log(result);
});
启动客户端:
node client.js
原文: https://github.com/hprose/hprose-nodejs/wiki/Hello-World
