eggjs / eggjs/egg

[egg-grpc] support multiple endpoints on different services

Open
#2,466 2 comments 0 reactions 1 assignee Claimed by @thonatos View on GitHub
Inactive
Dominant language
TypeScript
Stars
19k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

* **Node Version**:
* **Egg Version**:
* **Plugin Name**: egg-grpc
* **Plugin Version**: 1.0.3
* **Platform**:
* **Mini Showcase Repository**:

While gRPC is commonly used in micro services that shall be accessed from different endpoints, egg-grpc can not be configured with ease yet to support multiple endpoints on different gRPC services.

With proto definitions:
```protobuf
// app/proto/foo.proto
syntax = "proto3";

package example;

service Foo {
rpc Echo (TestRequest) returns (TestResponse) {}
}

message TestRequest {
int32 id = 1;
}

message TestResponse {
int32 id = 1;
}

// app/proto/bar.proto
syntax = "proto3";

package example;

service Bar {
rpc Echo (TestRequest) returns (TestResponse) {}
}

message TestRequest {
int32 id = 1;
}

message TestResponse {
int32 id = 1;
}

```

A possible config may be:
```js
// config/config.default.js
exports.grpc = {
endpoints: {
'example.Foo': 'localhost:50051',
'example.Bar': 'localhost:50052',
},
};
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.