Skip to content

hwan001/go-gRPC-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gRPC Sample code (go)

  • 구조
flowchart LR
    subgraph agent["agent"]
        agent_port["50051"]
    end

    subgraph server["server"]
        server_port["8080"]
    end

    request["api request"] 

    request --(HTTP)--> server_port
    server --(gRPC)--> agent_port
Loading
  • 프로젝트 구조
.
├── Makefile
├── README.md
├── agent
│   ├── agent.go
│   ├── agent.proto
│   ├── agentpb
│   │   ├── agent.pb.go
│   │   └── agent_grpc.pb.go
│   ├── go.mod
│   └── go.sum
├── cmd
│   └── main.go
├── go.mod
├── go.sum
└── server
    ├── go.mod
    ├── go.sum
    └── server.go
  • pb 코드 생성
make generate
  • tidy
make tidy
  • 실행
cd cmd
go run main.py
  • 테스트
# AnotherFunction
curl -X POST "http://localhost:8080/execute" \
-H "Content-Type: application/json" \
-d '{"function_name": "AnotherFunction", "payload": "Hello"}' 

# TestFunction
curl -X POST "http://localhost:8080/execute" \
-H "Content-Type: application/json" \
-d '{"function_name": "TestFunction", "payload": "Hello"}'

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published