All Projects → devsu → Grpc Gateway Generator

devsu / Grpc Gateway Generator

Licence: mit
A script to generate a ready to use grpc-gateway with swagger, by just providing the path to the protos and a simple configuration file.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Grpc Gateway Generator

Grpc Gateway
The gRPC-Gateway is a plugin of the Google protocol buffers compiler protoc. It reads protobuf service definitions and generates a reverse-proxy server which translates a RESTful HTTP API into gRPC. This server is generated according to the google.api.http annotations in your service definitions.
Stars: ✭ 12,223 (+67805.56%)
Mutual labels:  grpc, grpc-gateway
Clay
Proto-first minimal server platform for gRPС+REST+Swagger APIs
Stars: ✭ 212 (+1077.78%)
Mutual labels:  grpc, grpc-gateway
Protoeasy Go
Simpler usage of protoc. Deprecated.
Stars: ✭ 129 (+616.67%)
Mutual labels:  grpc, grpc-gateway
Micro Mesh
gRPC微服务架构实践
Stars: ✭ 50 (+177.78%)
Mutual labels:  grpc, grpc-gateway
Ovpm
OpenVPN Management Server - Effortless and free OpenVPN server administration
Stars: ✭ 256 (+1322.22%)
Mutual labels:  grpc, grpc-gateway
Grpc Hello World
An example of gRPC+grpc-gateway
Stars: ✭ 104 (+477.78%)
Mutual labels:  grpc, grpc-gateway
Rules protobuf
Bazel rules for building protocol buffers and gRPC services (java, c++, go, ...)
Stars: ✭ 206 (+1044.44%)
Mutual labels:  grpc, grpc-gateway
Gf Cli
GoFrame Command Line Interface, which is your helpmate for building GoFrame application with convenience.
Stars: ✭ 143 (+694.44%)
Mutual labels:  grpc, generator
docker-protobuf
An all-inclusive protoc Docker image
Stars: ✭ 105 (+483.33%)
Mutual labels:  grpc, grpc-gateway
micro
A simple tool kit for building microservices.
Stars: ✭ 15 (-16.67%)
Mutual labels:  grpc, grpc-gateway
Danby
A webserver that's also a grpc proxy for browsers
Stars: ✭ 26 (+44.44%)
Mutual labels:  grpc, grpc-gateway
Grpc Example
An example of using Go gRPC and tools from the greater gRPC ecosystem together with the GoGo Protobuf Project.
Stars: ✭ 352 (+1855.56%)
Mutual labels:  grpc, grpc-gateway
Grpc Jersey
gRPC<->Jersey bridge
Stars: ✭ 23 (+27.78%)
Mutual labels:  grpc, grpc-gateway
Tesla
Tesla is a gateway service that provides dynamic routing,waf,support spring cloud,gRPC,DUBBO and more.
Stars: ✭ 109 (+505.56%)
Mutual labels:  grpc, grpc-gateway
protoc-gen-grpc-gateway-ts
protoc-gen-grpc-gateway-ts is a Typescript client generator for the grpc-gateway project. It generates idiomatic Typescript clients that connect the web frontend and golang backend fronted by grpc-gateway.
Stars: ✭ 68 (+277.78%)
Mutual labels:  grpc, grpc-gateway
Turbo
A lightweight microservice tool, turn your grpc|thrift APIs into HTTP APIs!
Stars: ✭ 275 (+1427.78%)
Mutual labels:  grpc, grpc-gateway
Grpc Websocket Proxy
A proxy to transparently upgrade grpc-gateway streaming endpoints to use websockets
Stars: ✭ 395 (+2094.44%)
Mutual labels:  grpc, grpc-gateway
Rust Full Stack
Rust projects here are easy to use. There are blog posts for them also.
Stars: ✭ 745 (+4038.89%)
Mutual labels:  grpc
Gen
Converts a database into gorm structs and RESTful api
Stars: ✭ 825 (+4483.33%)
Mutual labels:  generator
Easybook
Book publishing as easy as it should be (built with Symfony components)
Stars: ✭ 744 (+4033.33%)
Mutual labels:  generator

grpc-gateway-generator

A script to generate a ready to use grpc-gateway, with swagger, by just providing the protos and a simple configuration file.

Status: Alpha, it's not production ready yet. See TODO list below.

Installation

Prerequisites

  • If you don't have go installed, install go
  • Install grpc-gateway dependencies. (ProtocolBuffers 3.0.0-beta-3 or later), and the following packages:
go get -u google.golang.org/grpc
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
go get -u github.com/golang/protobuf/protoc-gen-go
  • Install the script dependencies:

Clone

git clone https://github.com/devsu/grpc-gateway-generator

Usage

./generate.sh protos-path config-file project-path  

Arguments

  • protos-path: The path to the protos folder.

    The package names of the protos files must correspond to the folder structure. For example:

    • /protos/myapp/my-file.proto must have the package myapp, and
    • /protos/myapp/mymicroservice/another-file.proto must have the package myapp.mymicroservice
  • config-file: Path to a config.json file. The config file has two sections: gateway and backends.

    In the gateway section, you define the address that the gateway will listen into.

    The backends is an array of objects with 3 properties:

    • package: name of the package.
    • backend: what addres the GRPC server is running.
    • services: An object with the services names as keys, and the base paths of the services as values.

    See config.json for an example of how it should look:

    {
     "gateway": {
       "listen": ":9090"
     },
     "backends": [
       {
         "package": "myapp",
         "backend": "localhost:3000",
         "services": {
           "GreeterService": "/sample/greeter/"
         }
       },
       {
         "package": "myapp.mysubapp",
         "backend": "localhost:3000",
         "services": {
           "AnotherGreeterService": "/sample/another-greeter/"
         }
       }
     ]
    }
    
  • project-path: The path of the go project to be created. The gateway will be created in ${GOPATH}/src/${projectPath}. Read How to write Go Code to learn how to choose a proper project path.

Step by step guide

  • First, create your protos and add the corresponding annotations. You can see the grpc-gateway documentation or the sample file in examples/protos/myapp for an example.

  • Then you need to create a config file. (See instructions above)

  • Then you just need to run the command with the right arguments.

    For example, to create a grpc-gateway using the information in the example:

    ./generate.sh example/protos example/config.json github.com/my-user/my-gateway
    

TODO

  • Support TLS in both, the gateway, and the backends
  • Make swagger creation optional
  • Test on more OSs, currently only tested on Mac an Alpine
  • Clean up the script
  • Allow to configure authorization (currently it activates bearer authorization by default)
  • Upgrade swagger-ui?

License and Credits

Devsu LLC. MIT License. Copyright 2017.

Built by the GRPC experts at Devsu.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].