https://github.com/thinkerou/grpc-scala-json
Simple example of grpc with ScalaPB and JSON.
https://github.com/thinkerou/grpc-scala-json
grpc-java sbt scala scala-json scalapb
Last synced: about 1 year ago
JSON representation
Simple example of grpc with ScalaPB and JSON.
- Host: GitHub
- URL: https://github.com/thinkerou/grpc-scala-json
- Owner: thinkerou
- License: apache-2.0
- Created: 2018-04-28T08:26:16.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-29T13:39:56.000Z (almost 8 years ago)
- Last Synced: 2025-02-01T21:13:39.589Z (over 1 year ago)
- Topics: grpc-java, sbt, scala, scala-json, scalapb
- Language: Scala
- Size: 8.79 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# grpc-scala-json
Simple example of [grpc-java](https://github.com/grpc/grpc-java) with [ScalaPB](https://github.com/scalapb/ScalaPB) and [scalapb-json4s](https://github.com/scalapb/scalapb-json4s).
### Server
Run the following command:
```bash
➜ cd grpc-scala-json
➜ sbt
sbt:grpc-scala-json> compile
sbt:grpc-scala-json> run
[warn] Multiple main classes detected. Run 'show discoveredMainClasses' to see the list
Multiple main classes detected, select one to run:
[1] helloworld.HelloWorldClient
[2] helloworld.HelloWorldServer
[info] Packaging /Users/thinkerou/grpc-scala-json/target/scala-2.12/grpc-scala-json_2.12-0.1.jar ...
[info] Done packaging.
Enter number: 2
[info] Running helloworld.HelloWorldServer
Apr 28, 2018 4:16:29 PM helloworld.HelloWorldServer helloworld$HelloWorldServer$$start
信息: Server started and listening on 50052
```
### Client
Run the following command and input the path of JSON file:
```bash
➜ cd grpc-scala-json
➜ sbt
sbt:grpc-scala-json> runMain helloworld.HelloWorldClient ./data/helloworld.json
```
Default path of `helloworld.json` is `./data/helloworld.json`.