Skip to content
forked from izumin5210/grapi

😮 A surprisingly easy API server and generator in gRPC and Go

License

Notifications You must be signed in to change notification settings

younisshah/grapi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grapi

Build Status GoDoc Go Report Card Go project version license

😮 A surprisingly easy API server and generator in gRPC and Go

Features

  • You can develop and deploy API servers blazing fastly âš¡
  • Easily code generator
    • application (inspired by rails new and create-react-app)
    • gRPC services and their implementations (inspired by rails g (scaffold_)controller)
  • User-friendly protoc wrapper (inspired by protoeasy)
  • Provides gRPC and HTTP JSON API with single implementation, by using grpc-gateway
  • Generates codes followed google's API design guideline

asciicast

Getting Started

Installation

For Homebrew users

$ brew install protobuf
$ brew install izumin5210/tools/grapi

Downloads built binary

You should install protoc command from google/protobuf.

  • Linux:
    • curl -Lo grapi https://github.com/izumin5210/grapi/releases/download/v0.2.0/grapi_linux_amd64 && chmod +x grapi && sudo mv grapi /usr/local/bin
  • masOS:
    • curl -Lo grapi https://github.com/izumin5210/grapi/releases/download/v0.2.0/grapi_darwin_amd64 && chmod +x grapi && sudo mv grapi /usr/local/bin

Creates a new application

$ grapi init awesome-app

Creates a new service

$ grapi g service books

Or if you need full standard methods, you can get them with following command:

$ grapi g scaffold-service books

And you should register generated services to the grapiserver.Engine instance:

 // app/run.go
 
 // Run starts the grapiserver.
 func Run() error {
 	s := grapiserver.New(
 		grapiserver.WithDefaultLogger(),
 		grapiserver.WithServers(
+			server.NewBookServiceServer(),
-		// TODO
 		),
 	)
 	return s.Serve()
 }

If you updated service definition, you can re-generate .pb.go and .pb.gw.go with the following command:

$ grapi protoc

Starts server

$ grapi server

User-defined commands

$ grapi g command import-books
$ vim cmd/import-books/run.go  # implements the command
$ grapi import-books  # run the command

Build commands (including server)

$ grapi build

About

😮 A surprisingly easy API server and generator in gRPC and Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 97.0%
  • Makefile 2.5%
  • Shell 0.5%