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

     1  # RPC API
     2  
     3  This is an example of using an RPC based API
     4  
     5  ## Getting Started
     6  
     7  ### Run Micro API
     8  
     9  ```shell
    10  micro api
    11  ```
    12  
    13  ### Run Greeter Service
    14  
    15  ```shell
    16  go run greeter/srv/main.go
    17  ```
    18  
    19  ### Run Greeter API
    20  
    21  ```shell
    22  go run rpc.go
    23  ```
    24  
    25  ### Curl API
    26  
    27  ```shell
    28  curl -H 'Content-Type: application/json' -d '{"name": "Asim"}' http://localhost:8080/greeter/hello
    29  ```
    30  
    31  Output
    32  
    33  ```
    34  {
    35    "msg": "Hello Asim"
    36  }
    37  ```