Grpc hello service implementation
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package hello
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
pb "homelab.lan/music-agregator/gen/music_agregator/hello/v1"
|
||||
)
|
||||
|
||||
type HelloServer struct {
|
||||
pb.UnimplementedHelloServiceServer
|
||||
}
|
||||
|
||||
func NewHelloServer() *HelloServer {
|
||||
return &HelloServer{}
|
||||
}
|
||||
|
||||
func (server *HelloServer) Ping(ctx context.Context, req *pb.PingRequest) (*pb.PongResponse, error) {
|
||||
return &pb.PongResponse{}, nil
|
||||
}
|
||||
|
||||
func (server *HelloServer) Echo(ctx context.Context, req *pb.EchoRequest) (*pb.EchoResponse, error) {
|
||||
response := &pb.EchoResponse{
|
||||
Response: req.GetMsg(),
|
||||
}
|
||||
|
||||
return response, nil
|
||||
}
|
||||
Reference in New Issue
Block a user