gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/server/grpc/README.md (about)

     1  # GRPC Server
     2  
     3  The grpc server is a [micro.Server](https://godoc.org/gitee.com/liuxuezhan/go-micro-v1.18.0/server#Server) compatible server.
     4  
     5  ## Overview
     6  
     7  The server makes use of the [google.golang.org/grpc](google.golang.org/grpc) framework for the underlying server 
     8  but continues to use micro handler signatures and protoc-gen-micro generated code.
     9  
    10  ## Usage
    11  
    12  Specify the server to your micro service
    13  
    14  ```go
    15  import (
    16          "gitee.com/liuxuezhan/go-micro-v1.18.0"
    17          "github.com/micro/go-plugins/server/grpc"
    18  )
    19  
    20  func main() {
    21          service := micro.NewService(
    22                  // This needs to be first as it replaces the underlying server
    23                  // which causes any configuration set before it
    24                  // to be discarded
    25                  micro.Server(grpc.NewServer()),
    26                  micro.Name("greeter"),
    27          )
    28  }
    29  ```
    30  **NOTE**: Setting the gRPC server and/or client causes the underlying the server/client to be replaced which causes any previous configuration set on that server/client to be discarded. It is therefore recommended to set gRPC server/client before any other configuration