github.com/micro/go-micro/examples@v0.0.0-20210105173217-bf4ab679e18b/proxy/go/README.md (about)

     1  # Go
     2  
     3  This Go example uses vanilla net/http and the proxy
     4  
     5  - proxy.go: methods to call proxy
     6  - rpc_{client,server}.go: RPC client/server
     7  - http_{client,server}.go: HTTP client/server
     8  
     9  ## RPC Example
    10  
    11  Run proxy
    12  ```shell
    13  micro proxy
    14  ```
    15  
    16  Run server
    17  ```shell
    18  # serves Say.Hello
    19  go run rpc_server.go proxy.go
    20  ```
    21  
    22  Run client
    23  ```shell
    24  # calls go.micro.srv.greeter Say.Hello
    25  go run rpc_client.go proxy.go
    26  ```
    27  
    28  ## HTTP Example
    29  
    30  Run proxy with proxy handler
    31  ```shell
    32  micro proxy --handler=http
    33  ```
    34  
    35  Run server
    36  ```shell
    37  # serves /greeter
    38  go run http_server.go proxy.go
    39  ```
    40  
    41  Run client
    42  ```shell
    43  # calls /greeter
    44  go run http_client.go proxy.go
    45  ```