GrpcJsonTranscoder 0.4.0
See the version list below for details.
dotnet add package GrpcJsonTranscoder --version 0.4.0
NuGet\Install-Package GrpcJsonTranscoder -Version 0.4.0
<PackageReference Include="GrpcJsonTranscoder" Version="0.4.0" />
paket add GrpcJsonTranscoder --version 0.4.0
#r "nuget: GrpcJsonTranscoder, 0.4.0"
// Install GrpcJsonTranscoder as a Cake Addin #addin nuget:?package=GrpcJsonTranscoder&version=0.4.0 // Install GrpcJsonTranscoder as a Cake Tool #tool nuget:?package=GrpcJsonTranscoder&version=0.4.0
Grpc-Json Transcoder project
This is a filter that allows a RESTful JSON API client (Ocelot Gateway) to send requests to .NET Web API (Aggregation Service) over HTTP and get proxied to a gRPC service (on behind).
This project is inspired by grpc-gateway which is totally for golang, grpc-dynamic-gateway is for nodejs. And especially, Envoy gRPC-JSON transcoder is the best of transcoding in this area, but it is only on the infrastructure level. You also can use it just like my project used at coolstore-microservices.
gRPC parser borrows the idea from Ocelot.GrpcHttpGateway code-based.
Give a Star!
If you liked GrpcJsonTranscoder
project or if it helped you, please give a star ⭐ for this repository. That will not only help strengthen our .NET community but also improve cloud-native apps development skills for .NET developers in around the world. Thank you very much 👍
Check out my blog or say hi on Twitter!
How to run it!
$ docker-compose up
or
$ bash
$ start.sh # I haven't done it yet :p
In the mean time, we open up the visual studio, run multiple projects included OcelotGateway, AggregationRestApi, ProductCatalogGrpcServer and GreatGrpcServer
- OcelotGateway (.NET Core 2.2): http://localhost:5000
- AggregationRestApi (.NET Core 3.0): http://localhost:5001
- ProductCatalogGrpcServer (.NET Core 3.0): http://localhost:5002
- GreatGrpcServer (.NET Core 3.0): http://localhost:5003
Test it as below:
# gRPC
$ curl -X GET -H 'content-type: application/grpc' -k http://localhost:5000/say/Bob
$ {"Message":"Hello Bob"}
# gRPC
$ curl -X GET -H 'content-type: application/grpc' -k http://localhost:5000/products
$ {"Products":[{"Id":1,"Name":"product 1","Quantity":52,"Description":"description of product 1"},...]}
# gRPC
$ curl -X POST -H 'content-type: application/grpc' -d '{ "name": "product 1", "quantity": 1, "description": "this is product 1" }' -k http://localhost:5000/products
$ {"Product":{"Id":915,"Name":"product 1 created","Quantity":1,"Description":"this is product 1 created"}}
# REST Api
$ curl -X GET -H 'content-type: application/json' -k http://localhost:5000/weather
$ [{"date":"2019-08-17T18:34:41.1090164+07:00","temperatureC":-6,"temperatureF":22,"summary":"Sweltering"},{"date":"2019-08-18T18:34:41.1090371+07:00","temperatureC":27,"temperatureF":80,"summary":"Hot"},{"date":"2019-08-19T18:34:41.1090499+07:00","temperatureC":33,"temperatureF":91,"summary":"Balmy"},{"date":"2019-08-20T18:34:41.1090617+07:00","temperatureC":-14,"temperatureF":7,"summary":"Chilly"},{"date":"2019-08-21T18:34:41.1090743+07:00","temperatureC":22,"temperatureF":71,"summary":"Hot"}]
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Google.Protobuf (>= 3.9.1)
- Grpc.Core (>= 2.23.0)
- Grpc.Reflection (>= 2.23.0)
- Microsoft.AspNetCore.Http (>= 2.2.2)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.Http.Extensions (>= 2.2.0)
- Microsoft.Extensions.DependencyInjection (>= 2.2.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 2.2.0)
- Newtonsoft.Json (>= 12.0.2)
- Ocelot (>= 13.5.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.