implemented post creation, deletion and update api

This commit is contained in:
2025-11-18 23:25:56 +00:00
parent a1152dfba5
commit 5013b67db2
3 changed files with 27 additions and 7 deletions

View File

@@ -47,9 +47,11 @@ func main() {
}
r := gin.Default()
h := handlers.Handler{DB: db}
r.GET("/books", handlers.GetPosts)
r.POST("/books", handlers.CreatePost)
r.GET("/posts", h.GetPosts)
r.POST("/posts", h.CreatePost)
r.PUT("/posts/:id", h.UpdatePost)
r.GET("/", func(c *gin.Context) {
c.JSON(200, gin.H{"message": "Hello World"})