@smartcosmos/sample-protobufs
Advanced tools
Comparing version 0.0.1-rc.3 to 0.0.1
{ | ||
"name": "@smartcosmos/sample-protobufs", | ||
"version": "0.0.1-rc.3", | ||
"version": "0.0.1", | ||
"description": "Protobuf files for gRPC APIs", | ||
@@ -11,3 +11,3 @@ "author": "Smartrac Solutions, Inc.", | ||
}, | ||
"gitHead": "3dace78063bcb6e3212d6830bf9982402d290397" | ||
"gitHead": "ca76bc8979ebbbb60fc0a30bde0f280ae46ba0d2" | ||
} |
@@ -9,7 +9,37 @@ # `@smartcosmos/sample-protobufs` | ||
### Setting up a server | ||
```js | ||
import { GRPCServer } from '@smartcosmos/cosmos-service-builder'; | ||
import protoPaths from '@smartcosmos/sample-protobufs'; | ||
new GRPCServer({ | ||
configuration: { | ||
port: config.GRPC_PORT, | ||
host: config.GRPC_HOST, | ||
}, | ||
logger: config.LoggerConfig, | ||
}) | ||
.addService({ | ||
protoPackage: 'sample.hello', | ||
protoService: 'HelloService', | ||
protoPath: protoPaths.sample, // imported from a protobuf package | ||
}, { | ||
serviceClass: servicePackages.sample.hello.HelloService, // class of the service implementation | ||
params: { remotes, models }, | ||
}); | ||
``` | ||
### Setting up a client | ||
```js | ||
import { GRPCClient } from '@smartcosmos/cosmos-service-builder'; | ||
import protoPaths from '@smartcosmos/sample-protobufs'; | ||
// TODO: DEMONSTRATE API | ||
protoPaths.sample | ||
const grpcClients = { | ||
...new GRPCClient({ | ||
protoPath: protoPaths.sample, | ||
logger: config.LoggerConfig, | ||
}).connect(config.GRPC_SERVER_SAMPLE_ADDRESS), | ||
}; | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1989
45