From 6171344b65c5c05b8dc8b614c5f45ea9b12d0ca1 Mon Sep 17 00:00:00 2001 From: AustrianToast Date: Fri, 23 Feb 2024 23:57:41 +0100 Subject: [PATCH] small change modify so it matches the actual project --- main.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index bfe3ea7..e79f44d 100644 --- a/main.go +++ b/main.go @@ -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)