This commit is contained in:
2025-05-16 23:42:23 +08:00
commit 0deca45d06
19 changed files with 5274 additions and 0 deletions

31
router/router.go Executable file
View File

@@ -0,0 +1,31 @@
package router
import (
"github.com/gin-gonic/gin"
"net/http"
v1 "video/api/v1"
"video/utils/code"
"video/utils/exception"
)
func InitRouter() *gin.Engine {
gin.SetMode("release")
r := gin.Default()
r.NoRoute(func(c *gin.Context) {
c.JSON(http.StatusForbidden, exception.E{Code: code.NOT_FOUND_ROUTE, Msg: "Not Found Route", Err: nil})
})
r.NoMethod(func(c *gin.Context) {
c.JSON(http.StatusForbidden, exception.E{Code: code.NOT_FOUND_METH, Msg: "Not Found Method"})
})
api := r.Group("api")
{
baseV1 := new(v1.Base)
apiV1 := api.Group("v1")
{
apiV1.POST("base/CallUserNp", baseV1.CallUserNp)
apiV1.POST("base/CallUserPb", baseV1.CallUserPb)
}
}
return r
}