demo-3/gin/router.go

37 lines
602 B
Go

package gin
import (
"fmt"
"github.com/gin-gonic/gin"
"myschools.me/campus/demo-3/handler"
)
// 路由配置
func routerSetup(router *gin.Engine, rootpath *string) {
router.Use(gin.Recovery())
router.GET(`/health/check`, handler.HealthCheck)
r := router.Group(fmt.Sprintf("/%s", *rootpath))
{
r.POST(`/register`)
r.GET(`/accountcheck/:accname`)
r.POST(`/login`)
r.POST(`/forgot`)
}
ug := r.Group(`/user`)
{
ug.GET(`/choose/:orgid`)
ug.GET(`/detail`)
ug.POST(`/update`)
}
order := r.Group("order", AuthUserByDemo1())
{
order.POST("create", handler.CreateOrder)
}
}