chore: coded post req for create posts on db
All checks were successful
Backend ci / build (push) Successful in 7m43s
All checks were successful
Backend ci / build (push) Successful in 7m43s
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"gitea.d3m0k1d.ru/d3m0k1d/d3m0k1d.ru/backend/internal/repositories"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func Register(router *gin.Engine) {
|
||||
func Register(router *gin.Engine, db *sql.DB) {
|
||||
handler_posts := NewPostHandler(repositories.NewPostRepository(db))
|
||||
v1 := router.Group("api/v1")
|
||||
posts := v1.Group("posts")
|
||||
{
|
||||
posts.GET("/", GetPosts)
|
||||
posts.GET("/", handler_posts.GetPosts)
|
||||
posts.GET("/:id", GetPost)
|
||||
posts.POST("/", CreatePost)
|
||||
posts.POST("/", handler_posts.CreatePost)
|
||||
posts.PUT("/:id", UpdatePost)
|
||||
posts.DELETE("/:id", DeletePost)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user