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

     1  # Gin API Example
     2  
     3  This is an example of how to serve an API using gin
     4  
     5  ## Getting Started
     6  
     7  ### Run the Micro API
     8  
     9  ```
    10  $ micro api --handler=http
    11  ```
    12  
    13  ### Run the Greeter Service
    14  
    15  ```
    16  $ go run greeter/srv/main.go
    17  ```
    18  
    19  ### Run the Greeter API
    20  
    21  ```
    22  $ go run gin.go
    23  Listening on [::]:64738
    24  ```
    25  
    26  ### Curl the API
    27  
    28  Test the index
    29  ```
    30  curl http://localhost:8080/greeter
    31  {
    32    "message": "Hi, this is the Greeter API"
    33  }
    34  ```
    35  
    36  Test a resource
    37  ```
    38   curl http://localhost:8080/greeter/asim
    39  {
    40    "msg": "Hello asim"
    41  }
    42  ```