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 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); });
node-eos 官网
https://github.com/ulyn/node-eos
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。