Codebase list golang-github-go-kit-kit / 828ac17
Readme docs answering question from mailing list on profilesvc (#709) Wade Arnold authored 5 years ago Peter Bourgon committed 5 years ago
1 changed file(s) with 21 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
11
22 This example demonstrates how to use Go kit to implement a REST-y HTTP service.
33 It leverages the excellent [gorilla mux package](https://github.com/gorilla/mux) for routing.
4
5 Run the example with the optional port address for the service:
6
7 ```bash
8 $ go run ./cmd/profilesvc/main.go -http.addr :8080
9 ts=2018-05-01T16:13:12.849086255Z caller=main.go:47 transport=HTTP addr=:8080
10 ```
11
12 Create a Profile:
13
14 ```bash
15 $ curl -d '{"id":"1234","Name":"Go Kit"}' -H "Content-Type: application/json" -X POST http://localhost:8080/profiles/
16 {}
17 ```
18
19 Get the profile you just created
20
21 ```bash
22 $ curl localhost:8080/profiles/1234
23 {"profile":{"id":"1234","name":"Go Kit"}}
24 ```