Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

adonis2014/node-eos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

25 Commits

Repository files navigation

node-eos

eos(https://github.com/ulyn/eos) client for node.js

This module has been tested to work with eos version 2.1.0.

Installation

You can install it using npm:

$ npm install node-eos

How to use

  1. 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
	});
  1. 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;
	}
  1. 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);
 });

document

Filter

mock config file


	{
 "mock":"",
 "appService":{
 "mock":"serviceMock",
 "method":{
 "getSystemConfig":"success",
 "testList":"error"
 }
 },
 "service2":{
 "mock":"success",
 "method":{
 "testMap":"success",
 "testList":"error"
 }
 }
}

Exception

the errorFunc params

  • getMessage
  • getCode
  • getName

notes

  • please ensure that the eos is loaded only once

About

eos client for node.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /