Welcome! 👋
This is microservices written in go.
This content was based on this tutorial
We should explore methods like:
- GET
- POST
- PUT
-
requests
:-
curl
: choose your favorite tool to test -
postman
-
make
swagger generate client -f ../swagger.yaml -A go-microservices
curl -v -XGET localhost:8000/products | jq
curl -v localhost:8000/products -XPOST -H "Content-Type: application/json" -d '{"name":"Tea", "sku":"aaa-bbb-eee", "description":"I love tea", "price": 1.35}'
curl -v localhost:8000/products/1 -XPOST -H "Content-Type: application/json" -d '{"name":"Tea", "sku":"aaa-bbb-eee", "description":"I love tea", "price": 2.74}'
curl -v localhost:8000/products/1 -XDELETE
Note: need to use --data-binary
to ensure file is not converted to text
curl -vv localhost:9090/1/go.mod -X PUT --data-binary @test.png