github.com/micro/go-micro/examples@v0.0.0-20210105173217-bf4ab679e18b/greeter/api/beego/README.md (about) 1 # Beego API Example 2 3 This is an example of how to serve an API using beego 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 ```shell 16 $ go run greeter/srv/main.go 17 ``` 18 19 ### Run the Greeter API 20 21 ```shell 22 $ go run beego.go 23 ``` 24 25 ### Curl API 26 27 Test the index 28 29 ```shell 30 curl http://localhost:8080/greeter 31 ``` 32 33 Output 34 35 ```json 36 { 37 "message": "Hi, this is the Greeter API" 38 } 39 ``` 40 41 Test a resource 42 43 ```shell 44 curl http://localhost:8080/greeter/asim 45 ``` 46 47 Output 48 ```json 49 { 50 "msg": "Hello asim" 51 } 52 ```