当前位置: 软件>JavaScript软件
eos 的 Node.js 开发包 node-eos
本文导语: node-eos 是 eos 的 Node.js 客户端开发包。 init eos : var eos = require("node-eos"); eos.init({ zookeeper_ip: '192.168.0.224', zookeeper_port: 2181, long_connect: true, exclude_eos:[],//ignore eos debugging_server_ip: '', //debugging server...
node-eos 是 eos 的 Node.js 客户端开发包。
init eos :
var eos = require("node-eos");
eos.init({
zookeeper_ip: '192.168.0.224',
zookeeper_port: 2181,
long_connect: true,
exclude_eos:[],//ignore eos
debugging_server_ip: '', //debugging server ip
use_mock: true, //controll global mock
mock_config_file: __dirname + "/config_mock.json" //mock config file path
});
definde a eos service
module.exports = function(eos){
function testType(){
eos.Service.call(this);
this.appId = "test";
this.serviceId = "testType";
this.serviceVersion = "1.3";
}
eos.util.inherits(testType,eos.Service);
testType.prototype.testMap = function(map,str,successFunc,errorFunc){
var req = this._createReqPro("testMap",map,str);
eos.call(req,successFunc,errorFunc);
}
return testType;
}
call service
var test = require("./testType")(eos);
new test.appService().testMap({"a":"1","b":"2"},"abc",function(data){
console.log("get result:"+JSON.stringify(data));
},function(e){
console.log("exception:"+e);
});
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。