This is my GET Method the problem is that all i get in the json is one user instead there are 3 users in my database.
func GetUsers(c *gin.Context) {
var users = db.Find(&models.Person{})
c.JSON(200, users)
}
This is my GET Method the problem is that all i get in the json is one user instead there are 3 users in my database.
func GetUsers(c *gin.Context) {
var users = db.Find(&models.Person{})
c.JSON(200, users)
}
Try this:
func GetUsers(c *gin.Context) {
users := []models.Person{}
db.Find(&users)
c.JSON(200, &users)
}