A simple CRUD API in go
using gin and gorm with storage on postgreSQL
Make sure local PostgreSQL database is running. Then Run,
go mod tidy
make run
GET Albums
curl http://localhost:8080/albums
GET Album By ID
curl http://localhost:8080/albums/2
POST an Album
curl http://localhost:8080/albums \
--include \
--header "Content-Type: application/json" \
--request "POST" \
--data '{"title": "Fire","artist": "Tiesto","price": 29}'
DELETE Album By ID
curl -X DELETE http://localhost:8080/albums/2
UPDATE Album By ID
curl -X PUT -d '{"price" : 12}' http://localhost:8080/albums/1