From 43d05ce727c8e008153284ed1d5690eccb883fce Mon Sep 17 00:00:00 2001 From: Jasper Spahl Date: Tue, 25 Jan 2022 09:17:11 +0100 Subject: [PATCH] some stuff --- .vscode/launch.json | 11 +++++++++++ internal/api/api.go | 5 ++--- 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..15500d1 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,11 @@ +{ + "configurations": [ + { + "name": "Launch Package", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "." + } + ] +} \ No newline at end of file diff --git a/internal/api/api.go b/internal/api/api.go index 755cd74..725ba26 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -1,6 +1,7 @@ package api import ( + "log" "net/http" "strconv" @@ -60,12 +61,11 @@ func RegisterRoutes(router *gin.RouterGroup, prov types.IPersitenceProvider) { id, err := strconv.Atoi(c.Param("id")) if err != nil { c.String(http.StatusBadRequest, err.Error()) - return } + log.Println(id) item, err := prov.GetItem(id) if err != nil { c.String(http.StatusInternalServerError, err.Error()) - return } c.JSON(http.StatusOK, ItemToDTO(item)) }) @@ -88,7 +88,6 @@ func RegisterRoutes(router *gin.RouterGroup, prov types.IPersitenceProvider) { } if err := c.BindJSON(&item); err != nil { c.String(http.StatusBadRequest, err.Error()) - return } prov.CreateItem(ItemDTO{message: item.message}) c.Status(200)