Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
This commit is contained in:
Oliver Davies 2025-10-01 12:00:00 +01:00
parent a10fc038fd
commit 238571521d
2 changed files with 4 additions and 4 deletions

View file

@ -1,4 +1,4 @@
package lib
package albums
import (
"net/http"
@ -19,6 +19,6 @@ var albums = []album{
{ID: "3", Title: "Sarah Vaughan and Clifford Brown", Artist: "Sarah Vaughan", Price: 39.99},
}
func GetAlbums(c *gin.Context) {
func GetAll(c *gin.Context) {
c.IndentedJSON(http.StatusOK, albums)
}

View file

@ -5,13 +5,13 @@ import (
"github.com/gin-gonic/gin"
"code.oliverdavies.uk/opdavies/lab/go-gin/internal/lib"
"code.oliverdavies.uk/opdavies/lab/go-gin/internal/albums"
)
func main() {
r := gin.Default()
r.GET("/albums", lib.GetAlbums)
r.GET("/albums", albums.GetAll)
r.GET("/ping", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{