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

     1  # Meta API
     2  
     3  This example makes use of the micro API metadata handler.
     4  
     5  This will allow us to write standard go-micro services and set the handler/endpoint via service discovery metadata.
     6  
     7  ## Usage
     8  
     9  Run the micro API
    10  
    11  ```
    12  micro api
    13  ```
    14  
    15  Run this example. Note endpoint metadata when registering the handler
    16  
    17  ```
    18  go run meta.go
    19  ```
    20  
    21  Make a POST request to /example which will call go.micro.api.example Example.Call
    22  
    23  ```
    24  curl -H 'Content-Type: application/json' -d '{"name": "john"}' "http://localhost:8080/example"
    25  ```
    26  
    27  Make a POST request to /foo/bar which will call go.micro.api.example Foo.Bar
    28  
    29  ```
    30  curl -H 'Content-Type: application/json' -d '{}' http://localhost:8080/foo/bar
    31  ```