Skip to content
/ gRPC Public

gRPC promisify module for both Request and Response types.

License

Notifications You must be signed in to change notification settings

dotlim/gRPC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@dotlim/grpc

Asynchronous gRPC client.

gPRC Usage

  1. 安装依赖:

    npm install gRPC-Web google-protobuf
  2. 安装 protoc-gen-grpc-web 程序,生成 web javascript 文件

  3. 安装 protoc 程序,支撑 protoc-gen-grpc-web 运行(添加到环境变量)

  4. 使用命令生成 javascript 可执行文件:

       protoc -I=$DIR test.proto \
           --js_out=import_style=commonjs:$OUT_DIR \
           --grpc-web_out=import_style=commonjs,mode=grpcwebtext:$OUT_DIR
  5. 在项目中引用:

    import { EchoServiceClient } from './proto/echo_grpc_web_pb';
    import GrpcWebClient from '../index';
    
    const baseUrl = `localhost:8080`;
    
    export default new GrpcWebClient(EchoServiceClient, baseUrl);

About

gRPC promisify module for both Request and Response types.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published