Files
d3m0k1d.ru/backend/internal/handlers/registry_handlers.go
d3m0k1d 54436e9cba
All checks were successful
Backend ci / build (push) Successful in 3m11s
feat: add health hander and healtchek to docker image and update cd pipline for backend
2026-02-11 15:31:52 +03:00

26 lines
776 B
Go

package handlers
import (
"database/sql"
"gitea.d3m0k1d.ru/d3m0k1d/d3m0k1d.ru/backend/internal/repositories"
"github.com/gin-gonic/gin"
)
func Register(router *gin.Engine, db *sql.DB) {
handler_posts := NewPostHandlers(repositories.NewPostRepository(db))
handler_auth := NewAuthHandlers(repositories.NewAuthRepository(db))
router.GET("/health", func(c *gin.Context) { c.Status(200) })
v1 := router.Group("api/v1")
v1.GET("/callback/github", handler_auth.CallbackGithub)
v1.GET("/auth/github", handler_auth.LoginGithub)
posts := v1.Group("posts")
{
posts.GET("/", handler_posts.GetPosts)
posts.GET("/:id", handler_posts.GetPost)
posts.POST("/", handler_posts.CreatePost)
posts.PUT("/:id", handler_posts.UpdatePost)
posts.DELETE("/:id", DeletePost)
}
}