-
Notifications
You must be signed in to change notification settings - Fork 52
Hello World
小马哥 edited this page Jul 26, 2015
·
4 revisions
首先让我们从 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 --harmony server.js
var hprose = require("hprose");
var client = hprose.Client.create("http://127.0.0.1:8080/");
var proxy = client.useService();
proxy.hello("world", function(result) {
console.log(result);
});启动客户端:
node --harmony client.js
Hprose for Node.js 用户手册