make run
go run ./cmd/todo-list-server/main.go --port=3333
2022/02/24 10:26:49 Serving todo list at http://127.0.0.1:3333
make get
curl -i 127.0.0.1:3333
HTTP/1.1 200 OK
Content-Type: application/io.goswagger.examples.todo-list.v1+json
Date: Thu, 24 Feb 2022 01:38:34 GMT
Content-Length: 3
[]
make add
curl -i localhost:3333 -X POST -H 'Content-Type: application/io.goswagger.examples.todo-list.v1+json' -d "{\"description\":\"message ANDOM\"}"
HTTP/1.1 201 Created
Content-Type: application/io.goswagger.examples.todo-list.v1+json
Date: Thu, 24 Feb 2022 01:39:13 GMT
Content-Length: 39
{"description":"message ANDOM","id":1}
make modify
curl -i localhost:3333/1 -X PUT -H 'Content-Type: application/io.goswagger.examples.todo-list.v1+json' -d '{"description":"go shopping"}'
HTTP/1.1 200 OK
Content-Type: application/io.goswagger.examples.todo-list.v1+json
Date: Thu, 24 Feb 2022 01:39:41 GMT
Content-Length: 37
{"description":"go shopping","id":1}
make delete
curl -i localhost:3333/1 -X DELETE -H 'Content-Type: application/io.goswagger.examples.todo-list.v1+json'
HTTP/1.1 204 No Content
Date: Thu, 24 Feb 2022 01:40:03 GMT
check
make get
curl -i 127.0.0.1:3333
HTTP/1.1 200 OK
Content-Type: application/io.goswagger.examples.todo-list.v1+json
Date: Thu, 24 Feb 2022 01:40:24 GMT
Content-Length: 3
[]
make modify
curl -i localhost:3333/1 -X PUT -H 'Content-Type: application/io.goswagger.examples.todo-list.v1+json' -d '{"description":"go shopping"}'
HTTP/1.1 404 Not Found
Content-Type: application/io.goswagger.examples.todo-list.v1+json
Date: Thu, 24 Feb 2022 01:40:58 GMT
Content-Length: 41
{"code":404,"message":"not fountd id:1"}
- useing https://github.com/danielgtaylor/apisprout
- onliy first time
make mock-setup
- run mock server
make mock-run
- check
curl -i 127.0.0.1:8000