2025-10-01 12:00:00 +01:00
|
|
|
package albums
|
2025-09-30 13:37:45 +01:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type album struct {
|
|
|
|
|
ID string `json:"id"`
|
|
|
|
|
Title string `json:"title"`
|
|
|
|
|
Artist string `json:"artist"`
|
|
|
|
|
Price float64 `json:"price"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var albums = []album{
|
|
|
|
|
{ID: "1", Title: "Blue Train", Artist: "John Coltrane", Price: 56.99},
|
|
|
|
|
{ID: "2", Title: "Jeru", Artist: "Gerry Mulligan", Price: 17.99},
|
|
|
|
|
{ID: "3", Title: "Sarah Vaughan and Clifford Brown", Artist: "Sarah Vaughan", Price: 39.99},
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-01 12:00:00 +01:00
|
|
|
func GetAll(c *gin.Context) {
|
2025-09-30 13:37:45 +01:00
|
|
|
c.IndentedJSON(http.StatusOK, albums)
|
|
|
|
|
}
|