diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..800235aaf80518a245d16e4c71e9749dfd310fff --- /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 d486fcb7dd3ddc45c5726e92ff5aac30051d7b53..aa99bc954b18a98706ecf9051e59143b3a819ffc 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){