Go to file
2021-03-21 14:25:23 +03:00
cmd/go-jsonapi-example update gitignore 2021-03-20 20:53:05 +03:00
internal + paginated find 2021-03-21 14:25:23 +03:00
.gitignore update gitignore 2021-03-20 20:53:05 +03:00
go.mod not tested 2021-03-19 20:24:02 +03:00
go.sum not tested 2021-03-19 20:24:02 +03:00
LICENSE work in progress 2021-03-18 21:52:41 +03:00
Makefile not tested 2021-03-19 20:24:02 +03:00
README.md add mileage field 2021-03-20 23:40:18 +03:00

go-jsonapi-example

make && make run

Create a new car:

curl -X POST http://localhost:8080/v1/cars -d '{"data" : {"type" : "cars" , "attributes": {"brand" : "bmw", "model": "x5", "price": 999, "status": "OnTheWay", "mileage": 0}}}'

List cars:

curl -X GET http://localhost:8080/v1/cars

List paginated cars:

curl -X GET 'http://localhost:8080/v1/cars?page\[offset\]=0&page\[limit\]=2'
OR
curl -X GET 'http://localhost:8080/v1/cars?page\[number\]=1&page\[size\]=2'

Update:

curl -X PATCH http://localhost:8080/v1/cars/1 -d '{ "data" : {"type" : "cars", "id": "1", "attributes": {"model" : "x3"}}}'

Delete:

curl -X DELETE http://localhost:8080/v1/cars/2