Restructure project

This commit is contained in:
Nex
2020-04-07 21:28:09 +08:00
parent af67a473c9
commit 935d130a98
16 changed files with 114 additions and 84 deletions

View File

@@ -1,48 +1,5 @@
## BDLedger gRPC API
## BDLedger APIs
### Generating gRPC code in languages
This repository contains the original interface definitions of BDLedger APIs that currently support gRPC protocols. Reading the original interface definitions can provide a better understanding of BDLedger APIs and help you to utilize them more efficiently. You can also use these definitions with open source tools to generate client libraries, documentation, and other artifacts.
#### Installling tools
Download the [Protocol Buffers compiler](https://github.com/protocolbuffers/protobuf/releases) (protoc-3.11.4-*) for your platform and add `protoc` to `PATH` environment variable
For generating Go code:
```bash
GIT_TAG="v1.4.0-rc.4"
go get -d -u github.com/golang/protobuf/protoc-gen-go
git -C "$(go env GOPATH)"/src/github.com/golang/protobuf checkout $GIT_TAG
go install github.com/golang/protobuf/protoc-gen-go
```
(Update to google.golang.org/protobuf when https://github.com/grpc/grpc-go/pull/3435 resolves)
For generating Java code: From `bdledger-sdk-java` run `gradle generateProto`
For generating Node.js code:
```bash
npm install -g grpc-tools
```
For generating TypeScript definitions, also run:
```bash
npm install -g protoc-gen-ts
```
For frontend JavaScript:
```bash
git clone https://github.com/grpc/grpc-web
cd grpc-web
sudo make install-plugin
```
References:
- [Go Quick Start](https://grpc.io/docs/quickstart/go.html#prerequisites)
- [gRPC Go FAQ](https://github.com/grpc/grpc-go#faq)
**TODO: Look into [protobuf.js](https://github.com/protobufjs/protobuf.js) for Nodes.js and frontend**
**TODO: Look into [Kroto+](https://github.com/marcoferrer/kroto-plus) for Kotlin**
#### Generating code
Run
```bash
./scripts/gen [go] [nodejs] [ts]
```
- [gRPC APIs](grpc/README.md)