github.com/micro/go-micro/examples@v0.0.0-20210105173217-bf4ab679e18b/greeter/api/rest/README.md (about) 1 # REST API 2 3 This is an example of how to serve REST behind the API using go-restful 4 5 ## Getting Started 6 7 ### Run Micro API 8 9 ``` 10 $ micro api --handler=http 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 rest.go 23 ``` 24 25 ### Curl API 26 27 ```shell 28 curl http://localhost:8080/greeter 29 ``` 30 31 Output 32 33 ```json 34 { 35 "message": "Hi, this is the Greeter API" 36 } 37 ``` 38 39 Test a resource 40 41 ```shell 42 curl http://localhost:8080/greeter/asim 43 ``` 44 45 Output 46 ```json 47 { 48 "msg": "Hello asim" 49 } 50 ```