https://github.com/catsmiaow/node-grpc-typescript
Node.js gRPC Structure for TypeScript example
https://github.com/catsmiaow/node-grpc-typescript
google-protobuf grpc grpc-js node node-grpc nodejs typescript
Last synced: 12 months ago
JSON representation
Node.js gRPC Structure for TypeScript example
- Host: GitHub
- URL: https://github.com/catsmiaow/node-grpc-typescript
- Owner: CatsMiaow
- License: mit
- Created: 2018-12-13T10:23:19.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-11-22T03:40:31.000Z (over 1 year ago)
- Last Synced: 2025-03-29T12:04:26.942Z (12 months ago)
- Topics: google-protobuf, grpc, grpc-js, node, node-grpc, nodejs, typescript
- Language: TypeScript
- Homepage:
- Size: 1.14 MB
- Stars: 124
- Watchers: 4
- Forks: 32
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-grpc-typescript
Node.js gRPC structure with [google.protobuf](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) for TypeScript example
- This example uses [ts-proto](https://github.com/stephenh/ts-proto) as the TypeScript plugin.
- For an example using the [grpc_tools_node_protoc_ts](https://github.com/agreatfool/grpc_tools_node_protoc_ts) plugin, see the following [branch](https://github.com/CatsMiaow/node-grpc-typescript/tree/grpc_tools_node_protoc_ts) source.
## Installation
```sh
npm ci
```
## Build
```sh
# exports to *.proto to *.ts
npm run build
npm run lint
```
## Server Start
```sh
npm start #= node dist/server
```
## Client Test
Start the server before testing client commands.
```sh
# 1. Request
npm run client #= node dist/client
# 2. with Parameter
npm run client blahblahblah
# 3. Error
npm run client error
# 4. Stream
npm run client stream
# 5. Health Check
npm run health
```
### Documentation
- [Node.js gRPC Documentation](https://grpc.io/grpc/node/grpc.html)
- [Protocol Buffers](https://developers.google.com/protocol-buffers/docs/proto3)
- [gRPC for Node.js](https://github.com/grpc/grpc-node)