1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Node.jsのgRPC Clientツール:grpc-caller

Last updated at Posted at 2019-08-19

Node.jsがクライアントとしてgRPCのメソッドを呼び出したい場合は、
https://github.com/grpc/grpc-node
にてやり方を記載しておりますが、一番シンプルなClientのCallerとして、「grpc-caller」は便利だと思います。

「node-grpc-client」というツールも試しましたが、やはり「grpc-caller」ですね。

インストール

npm install grpc-caller

サンプル

const path = require('path')
const caller = require('grpc-caller')

const PROTO_PATH = path.resolve(__dirname, './protos/cassandra.proto')
const client = caller('localhost:50051', PROTO_PATH, 'Calendar')

client.getCalendar({ calendarId: '20191010abc' }, (err, res) => {
  console.log(res)
})

以上

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?