From 9af1087d7510c4a5488e87ef48f8d855426204bf Mon Sep 17 00:00:00 2001 From: clupus <154858@sch.bme.hu> Date: Wed, 1 Dec 2021 17:04:34 +0100 Subject: [PATCH] Docker file hozzaadva --- Dockerfile | 6 ++++++ routes/get.go | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..800235a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM golang:alpine +RUN mkdir /app +COPY . /app +WORKDIR /app +RUN go build -o main . +CMD ["/app/main"] \ No newline at end of file diff --git a/routes/get.go b/routes/get.go index d486fcb..aa99bc9 100644 --- a/routes/get.go +++ b/routes/get.go @@ -8,14 +8,24 @@ import ( "net/http" ) +type QuestionResponse struct { + Data []models.Question `json:"data" binding:"required"` +} + func List(c *gin.Context){ var a []models.Question - result := dbHelper.Db.Find(&a) + result:= dbHelper.Db.Find(&a) if result.Error != nil { fmt.Println("hiba a lekeresben") } - c.JSON(http.StatusOK, a) + + var response QuestionResponse + response.Data = a + + fmt.Println(response) + + c.JSON(http.StatusOK, response) } func View(c *gin.Context){ -- GitLab