small change

modify so it matches the actual project
This commit is contained in:
AustrianToast 2024-02-23 23:57:41 +01:00
parent a9e9a5d023
commit 6171344b65
No known key found for this signature in database
GPG Key ID: 5CD422268E489EB4

16
main.go
View File

@ -8,17 +8,17 @@ import (
// album represents data about a record album.
type album struct {
ID string `json:"id"`
Title string `json:"title"`
Artist string `json:"artist"`
Price string `json:"price"`
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
Filepath string `json:"filepath"`
}
// albums slice to seed record album data.
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"},
{ID: "1", Title: "Blue Train", Description: "John Coltrane", Filepath: "56.99"},
{ID: "2", Title: "Jeru", Description: "Gerry Mulligan", Filepath: "17.99"},
{ID: "3", Title: "Sarah Vaughan and Clifford Brown", Description: "Sarah Vaughan", Filepath: "39.99"},
}
func remove(slice []album, s int) []album {
@ -27,6 +27,8 @@ func remove(slice []album, s int) []album {
func main() {
router := gin.Default()
router.SetTrustedProxies(nil)
router.GET("/albums", getAlbums)
router.GET("/albums/:id", getAlbumByID)
router.POST("/albums", postAlbums)