goldgorilla/routers/router.go

26 lines
536 B
Go
Raw Normal View History

package routers
import (
"github.com/gin-gonic/gin"
"sourcecode.social/greatape/goldgorilla/controllers"
)
type Router struct {
router *gin.Engine
}
func (r *Router) RegisterRoutes(rCtrl *controllers.RoomController) error {
gin.SetMode(gin.ReleaseMode)
r.router = gin.Default()
r.router.Use(gin.Recovery())
registerRoomRoutes(r.router.Group("/room"), rCtrl)
2023-08-31 13:19:15 +00:00
r.router.GET("/healthcheck", rCtrl.HealthCheck)
return nil
}
func (r *Router) Serve(addr string) error {
println("serving on ", addr)
return r.router.Run(addr)
}