small change
modify so it matches the actual project
This commit is contained in:
parent
a9e9a5d023
commit
6171344b65
12
main.go
12
main.go
@ -10,15 +10,15 @@ import (
|
|||||||
type album struct {
|
type album struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Artist string `json:"artist"`
|
Description string `json:"description"`
|
||||||
Price string `json:"price"`
|
Filepath string `json:"filepath"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// albums slice to seed record album data.
|
// albums slice to seed record album data.
|
||||||
var albums = []album{
|
var albums = []album{
|
||||||
{ID: "1", Title: "Blue Train", Artist: "John Coltrane", Price: "56.99"},
|
{ID: "1", Title: "Blue Train", Description: "John Coltrane", Filepath: "56.99"},
|
||||||
{ID: "2", Title: "Jeru", Artist: "Gerry Mulligan", Price: "17.99"},
|
{ID: "2", Title: "Jeru", Description: "Gerry Mulligan", Filepath: "17.99"},
|
||||||
{ID: "3", Title: "Sarah Vaughan and Clifford Brown", Artist: "Sarah Vaughan", Price: "39.99"},
|
{ID: "3", Title: "Sarah Vaughan and Clifford Brown", Description: "Sarah Vaughan", Filepath: "39.99"},
|
||||||
}
|
}
|
||||||
|
|
||||||
func remove(slice []album, s int) []album {
|
func remove(slice []album, s int) []album {
|
||||||
@ -27,6 +27,8 @@ func remove(slice []album, s int) []album {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
router := gin.Default()
|
router := gin.Default()
|
||||||
|
router.SetTrustedProxies(nil)
|
||||||
|
|
||||||
router.GET("/albums", getAlbums)
|
router.GET("/albums", getAlbums)
|
||||||
router.GET("/albums/:id", getAlbumByID)
|
router.GET("/albums/:id", getAlbumByID)
|
||||||
router.POST("/albums", postAlbums)
|
router.POST("/albums", postAlbums)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user