Skip to content

amar-preet/go-crud-rest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-crud-rest

A simple CRUD API in go using gin and gorm with storage on postgreSQL

Running the Service locally

Make sure local PostgreSQL database is running. Then Run,

go mod tidy
make run

Testing the endpoints

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

About

CRUD REST API in go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published