Quick start

Detailed examples referenceherearrow-up-right

Install protoc plugins

Install as needed, the commands for the framework to auto-generate code can be found incmd/directory

## Generate .pb.go files
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
## Generate _grpc.pb.go files, gRPC server and client
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
## Generate _amqp.pb.go files, RabbitMQ server and client
go install github.com/asjard/asjard/cmd/protoc-gen-go-amqp@latest
## Generate _asynq.pb.go files, Asynq server and client
go install github.com/asjard/asjard/cmd/protoc-gen-go-asynq@latest
## Generate _rest.pb.go files, HTTP server
go install github.com/asjard/asjard/cmd/protoc-gen-go-rest@latest
## Generate _rest_gw.pb.go files, HTTP protocol to gRPC protocol
go install github.com/asjard/asjard/cmd/protoc-gen-go-rest2grpc-gw@latest
## Generate _validate.pb.go files, parameter validation
go install github.com/asjard/asjard/cmd/protoc-gen-go-validate@latest
## Generate enum.pb.ts files, TypeScript enum generation
go install github.com/asjard/asjard/cmd/protoc-gen-ts-enum@latest
## Generate umi.pb.ts files, Umi request generation
go install github.com/asjard/asjard/cmd/protoc-gen-ts-umi@latest
## Generate pb.ts files, TypeScript type definitions
go install github.com/asjard/asjard/cmd/protoc-gen-ts@latest

Define protobuf file

Generate Go code from the proto file

Add a new service

Add configuration file

Start the service

After successful start you will see information similar to the following:

Test

Success

You will get a result similar to the following

Failure

You will get a result similar to the following

The above examples can be viewed ingithub.com/asjard/asjard/_examples/svc-example/apis/api/v1/sample.goandgithub.com/asjard/asjard/_examples/protos-repo/examples/api/v1/sample.protorespectively

With the above example you have started the simplest service that includes HTTP and gRPC. Later I will enable various features for you via configuration, such asCORS,OpenAPI,parameter validation,tracingand other features

Last updated