- Create greeting-api.go inside the api directory by executing the command $ mkdir api && cd api && touch greeting-api.go.
- Copy the following content to greeting-api.go:
package mainimport ( "context" "encoding/json" "log" "strings" hello "../proto" "github.com/micro/go-micro" api "github.com/micro/micro/api/proto")type Say struct { Client hello.SayClient}func (s *Say) Hello(ctx context.Context, req *api.Request, rsp *api.Response) error { log.Print("Received Say.Hello request - Micro Greeter API") name, ok := req.Get["name"] if ok { response, err := s.Client.Hello ( ctx, &hello.Request { Name: strings.Join(name.Values, " "), } ) if err != nil { return err } message, _ := json.Marshal ( map[string]string { "message": response.Msg, ...