【文件属性】:
文件名称:eos的Node.js开发包node-eos.zip
文件大小:22KB
文件格式:NONE
更新时间:2022-08-06 00:42:54
开源项目
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);
});
标签:nodeeos
【文件预览】:
node-eos-master
----.gitignore(40B)
----README.md(2KB)
----examples()
--------README.md(855B)
--------package.json(594B)
--------testType.js(566B)
--------index.js(1009B)
--------start.js(738B)
--------config_mock.js(214B)
----package.json(706B)
----index.js(38B)
----.npmignore(37B)
----lib()
--------net()
--------exception.js(3KB)
--------params.js(780B)
--------zookeeper()
--------base_service.js(2KB)
--------filter()
--------protocol()
--------eos.js(3KB)