init
This commit is contained in:
31
network/http/handlers/main.go
Normal file
31
network/http/handlers/main.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"go_oxspeak_server/database"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Handler struct {
|
||||
DB *gorm.DB
|
||||
}
|
||||
|
||||
func CreateRouter() *gin.Engine {
|
||||
router := gin.Default()
|
||||
|
||||
handler := &Handler{DB: database.DB}
|
||||
|
||||
api := router.Group("/api")
|
||||
{
|
||||
AddChannelRoutes(api, handler)
|
||||
}
|
||||
|
||||
router.GET("/health", handler.healthcheck)
|
||||
|
||||
return router
|
||||
}
|
||||
|
||||
func (h *Handler) healthcheck(c *gin.Context) {
|
||||
c.JSON(200, gin.H{"status": "ok"})
|
||||
}
|
||||
Reference in New Issue
Block a user