PostIndex done

This commit is contained in:
2024-02-21 19:33:41 -06:00
parent 4e4d52527f
commit 455de5a771
3 changed files with 13 additions and 1 deletions

View File

@@ -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,
})
}