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

     1  # Proxy API
     2  
     3  This is an example of using the micro api as a http proxy.
     4  
     5  Using the api as a http proxy gives you complete control over what languages or libraries to use 
     6  at the API layer. In this case we're using go-web to easily register http services.
     7  
     8  ## Usage
     9  
    10  Run micro api with http proxy handler
    11  
    12  ```
    13  micro api --handler=http
    14  ```
    15  
    16  Run this proxy service
    17  
    18  ```
    19  go run proxy.go
    20  ```
    21  
    22  Make a GET request to /example/call which will call go.micro.api.example Example.Call
    23  
    24  ```
    25  curl "http://localhost:8080/example/call?name=john"
    26  ```
    27  
    28  Make a POST request to /example/foo/bar which will call go.micro.api.example Foo.Bar
    29  
    30  ```
    31  curl -H 'Content-Type: application/json' -d '{}' http://localhost:8080/example/foo/bar
    32  ```