npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

kigo-rpc

v1.1.1

Published

```bash $ cnpm i kigo-rpc --save-dev ```

Readme

安装

$ cnpm i kigo-rpc --save-dev

用法

  • 直接引用需要使用的service文件,调用其中的方法即可
  • 只会加载已经引用的Service
  • Service不用再写在特定目录下
const friendService=require('./service/FriendService')
co(function *()
{
    yield friendService.isUserInGuestList(userId, 222);
})

配置文件

  • 默认加载项目执行目录(process.cwd())同级目录rpc下的配置文件,默认配置目录结构如下
rpc
  ├──app.conf
  ├──module.json
  ├──module-xxx.json
  • 也可以设置环境变量,将配置文件放在一个固定的系统目录 这样多个进程可以共享配置
process.env.moduleDir='/data/home/rpc';

Service编写

  • 模块导出Service对象 编写自己的Service时 需要继承Service
const Service = require('kigo-rpc').Service;

function DemoService() {
    Service.call(this,'demoService','com.melot.test');
}
util.inherits(DemoService, Service);

module.exports=new DemoService();
  • demoService 和配置文件中的key对应起来即可 com.melot.test 为interfancename

API方式创建Service

  • 除了通过引用文件方式设置service,也可以直接通过API方式new Service
  • 参考 example/createService.js
const InvokeConfig = require('kigo-rpc').InvokeConfig;
const interfanceName='com.melot.test';
var config = InvokeConfig.fromJson({
    "moduleName": "friendservice",
    "moduleVersion": "1.0.9",
    "filters": ["cache", "degrade", "circuitbreaker"],
    "methods": []
})
var service =new Service(InvokeConfig,interfanceName);

或者 

var service =new Service('demoService',interfanceName) //这里需要配置文件中有 demoService 的配置

//自定义方法
service.xxxMethod=function()
{

}

多租户相关

  • 通过@melot/Context模块来模拟线程变量 传递租户信息 Cat的transaction对象等
  • rpc模块会取出Context中的租户对象传递到java端
  • 具体用法参考example/demo.js 和 @melot/Context模块