Skip to content

A shell script to generate a golang project uses grpc-gateway and proto to expose api

License

Notifications You must be signed in to change notification settings

akoserwal/gen-grpc-gateway-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gen-grpc-gateway-api

A shell script that can be used to generate a Go project that utilizes the gRPC-gateway and protobuf to expose a simple API. By using the gen-grpc.sh generator, you can quickly get started with gRPC-gateway.

Using the gen-grpc.sh generator you can quickly get started with grpc-gateway

Guide to use the script: Automate gRPC-Gateway project generation in Golang with gen-grpc-gateway-api

Prerequisite

Generate project

./gen-grpc.sh

It will prompt for project name, domain name and service name for the proto

Example

Enter project name: test
Enter domain name: akoserwal
go: creating new go.mod: module github.com/akoserwal/test
Enter service name (e.g., Greeter): Hello
...

Project 'test' created with grpc-gateway
cd test
make server
make client
curl '0.0.0.0:8080/v1/hello'

Generate project structure

 test git:(main) ✗ tree
.
├── Makefile
├── cmd
│   ├── client
│   │   └── main.go
│   └── server
│       └── main.go
├── go.mod
├── go.sum
├── internal
│   └── helloservice.go # sample service
├── proto
│   ├── google
│   │   └── api
│   │       ├── annotations.proto
│   │       └── http.proto
│   └── hello
│       └── hello.proto # API definition
└── protogen
    └── golang
        └── hello
            ├── hello.pb.go
            ├── hello.pb.gw.go
            └── hello_grpc.pb.go

About

A shell script to generate a golang project uses grpc-gateway and proto to expose api

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages