diff --git a/.gitea/template b/.gitea/template index 0d4c03d..6319596 100644 --- a/.gitea/template +++ b/.gitea/template @@ -1 +1,5 @@ api/*.proto + +Makefile + +cmd/** diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..14853f8 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +generate: + rm -rf proto + mkdir -p proto + + protoc -I ./api \ + --go_out ./proto --go_opt paths=source_relative \ + --go-grpc_out ./proto --go-grpc_opt paths=source_relative \ + --grpc-gateway_out ./proto --grpc-gateway_opt paths=source_relative \ + --swagger_out=allow_merge=true,merge_file_name=main:./proto \ + ./api/main.proto + +run: + go run ./cmd/${REPO_NAME_SNAKE}/main.go diff --git a/api/main.proto b/api/main.proto index 460ea99..46002fd 100644 --- a/api/main.proto +++ b/api/main.proto @@ -1,5 +1,17 @@ syntax = "proto3"; -package crabs.${REPO_NAME}; +package crabs.${REPO_NAME_SNAKE}; import "google/api/annotations.proto"; + +service ${REPO_NAME_PASCAL} { + rpc Ping(PingReq) returns (PingRsp) { + option (google.api.http) = { + get: "/ping" + }; + } +} + +message PingReq {} + +message PingRsp {} diff --git a/cmd/${REPO_NAME_SNAKE}/main.go b/cmd/${REPO_NAME_SNAKE}/main.go new file mode 100644 index 0000000..a3dd973 --- /dev/null +++ b/cmd/${REPO_NAME_SNAKE}/main.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("Hello, World!") +}