Skip to content

lixiaobin-bjhl/egg-dubbo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

功能说明

egg的dubbo插件,dubbo客户端

使用示例

  • 将代码拷贝到工程的lib/plugin目录下
  • 插件配置代码
// config/plugin.ts
import { EggPlugin } from 'egg'
import path = require('path');

const plugin: EggPlugin = {
    dubbo: {
        enable: true,
        path: path.resolve(__dirname, '../lib/plugin/dubbo/')
    }
}

export default plugin
  • 调用
    
import { Controller } from 'egg';

export default class HomeController extends Controller {
  public async index() {
     this.ctx.body = await this.app.dubboClinent.dubboAgent.AreaService.getAllCity()
  }
}
   
  • typeScript 声明
import "egg";

declare module "egg" {
    interface Application {
        dubboClinent: {
          dubboAgent: {
            AreaService: {
              getAllCity(): Promise<Any>;
            }
          }
        }
    }
}

Releases

No releases published

Packages

No packages published