https://github.com/dills122/grpc-playground
An example grpc app I'm building to learn the framework
https://github.com/dills122/grpc-playground
grpc grpc-tooling proto
Last synced: 6 months ago
JSON representation
An example grpc app I'm building to learn the framework
- Host: GitHub
- URL: https://github.com/dills122/grpc-playground
- Owner: dills122
- License: mit
- Created: 2020-01-15T01:34:24.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-15T02:46:15.000Z (over 5 years ago)
- Last Synced: 2025-02-06T11:50:19.850Z (8 months ago)
- Topics: grpc, grpc-tooling, proto
- Language: JavaScript
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# gRPC Tooling & Utils
[](https://www.codefactor.io/repository/github/dills122/grpc-playground)
gRPC tooling to help simplify some of the tasks required by the framework.
Current Features:
- `ClientFactory` - Builds a client for a given service and proto
- `SeverFactory` - Builds a server for all the needed services and protosThis allows for some cleaner and more organized code since all of your service definitions are within a config.
## Example Service config
```json
{
"protoDefinitionPath": "protos",
"Services": {
"FirstService": {
"protoPath": "/path/to/proto.proto",
"namespace": "namespace",
"serviceName": "ServiceName"
}
}
}
```## Using Server Factory
```javascript
const { createServer } = require("grpc-tooling");
const config = require("path/to/service/config");createServer
.serverFactory(config)
.then(() => {
//Run any tasks needed once the server is started
})
.catch((err) => {
//Handle server error
});
```## Using Client Factory
```javascript
const { clientFactory } = require("grpc-tooling");
const config = require("path/to/service/config");const { ClientService } = config.Services;
clientFactory(
ClientService.protoPath,
ClientService.serviceName,
ClientService.namespace
)
.then((client) => {})
.catch((err) => {
console.log(err);
process.exit(1);
});
```