Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions profile.go → profile/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ package profile
import (
"log"

"golang.org/x/net/context"
"github.com/ensep/grpc101/proto/profile"
"golang.org/x/net/context"
)

type Server struct {
profile.UnimplementedProfileServer
}

func (s *Server) Create(ctx context.Context, req *profile.CreateRequest) (*profile.CreateResponse, error) {
log.Printf("Receive message body from client: %s", req.Body)
return &Message{Body: "Profile Created!"}, nil
log.Printf("Receive message body from client: %s", req.Name)
return &profile.CreateResponse{Message: "Profile Created!"}, nil
}
5 changes: 3 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package main

import (
"fmt"
"github.com/ensep/grpc101/profile"
pb "github.com/ensep/grpc101/proto/profile"
"log"
"net"

"github.com/ensep/grpc101/proto/profile"
"google.golang.org/grpc"
)

Expand All @@ -23,7 +24,7 @@ func main() {

grpcServer := grpc.NewServer()

profile.RegisterProfileServiceServer(grpcServer, &s)
pb.RegisterProfileServer(grpcServer, &s)

if err := grpcServer.Serve(lis); err != nil {
log.Fatalf("failed to serve: %s", err)
Expand Down