Last active
          February 8, 2020 22:14 
        
      - 
      
- 
        Save asim/79d05fd3c44d944093c470e70d094534 to your computer and use it in GitHub Desktop. 
    A go-micro service
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package main | |
| import ( | |
| "context" | |
| "log" | |
| pb "github.com/micro/examples/helloworld/proto" | |
| "github.com/micro/go-micro/v2" | |
| ) | |
| type Greeter struct{} | |
| func (g *Greeter) Hello(ctx context.Context, req *pb.Request, rsp *pb.Response) error { | |
| rsp.Greeting = "Hello " + req.Name | |
| return nil | |
| } | |
| func main() { | |
| service := micro.NewService( | |
| micro.Name("helloworld"), | |
| ) | |
| service.Init() | |
| pb.RegisterGreeterHandler(service.Server(), new(Greeter)) | |
| if err := service.Run(); err != nil { | |
| log.Fatal(err) | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment