A simple RESTful API built with Go and Gin framework for managing music albums.
This API provides endpoints to perform CRUD operations on a collection of music albums. Each album contains information about its ID, title, artist, and price.
- Get all albums
- Get a specific album by ID
- Add a new album
- Go 1.16 or higher
- Gin web framework
- Install dependencies
go get -u github.com/gin-gonic/gin
- Start the server
go run main.go
The server will start on localhost:8080
GET /albums
GET /albums/:id
POST /albums
Request body example:
{
"id": "3",
"title": "To Pimp A Butterfly",
"artist": "Kendrick Lamar",
"price": 59.99
}
The API comes pre-loaded with sample albums:
- DAMN. by Kendrick Lamar
- Section.80 by Kendrick Lamar
- Black Panther: The Album by Kendrick Lamar
- Whole Lotta Red by Playboi Carti