PostIndex done
This commit is contained in:
@@ -25,8 +25,19 @@ func PostsCreate(c *gin.Context) {
|
||||
}
|
||||
|
||||
//Return it
|
||||
|
||||
c.JSON(200, gin.H{
|
||||
"post": post,
|
||||
})
|
||||
}
|
||||
|
||||
func PostsIndex(c *gin.Context) {
|
||||
// Get the post
|
||||
var posts []models.Post
|
||||
initializers.DB.Find(&posts)
|
||||
|
||||
// Respond with them
|
||||
c.JSON(200, gin.H{
|
||||
"posts": posts,
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user