Ai
1 Star 0 Fork 0

cheneylau/components

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
route.go 935 Bytes
一键复制 编辑 原始数据 按行查看 历史
Alan_liu 提交于 2022-03-07 11:06 +08:00 . ++
package web_server
import (
"gitee.com/cheneylau/components/com"
"gitee.com/cheneylau/components/web-server/controller"
"gitee.com/cheneylau/components/web-server/controller/user"
"github.com/gin-gonic/gin"
"net/http"
"os"
"path"
)
func ConfigRoute(r *gin.Engine) {
r.Use(gin.Logger())
r.Use(com.Cors())
r.Use(gin.Recovery())
r.StaticFS("/static", http.Dir(path.Dir(os.Args[0])+"/static"))
r.LoadHTMLGlob(path.Dir(os.Args[0])+"/static/templates/**/*")
r.GET("/", func(context *gin.Context) {
context.Redirect(302, "/static/hospital")
})
authorized := r.Group("/hospital")
authorized.POST("/list", controller.HospitalList)
authorized.POST("/add", controller.HospitalAdd)
authorized.POST("/delete", controller.HospitalDelete)
apiGroup := r.Group("api")
v1 := apiGroup.Group("v1")
userGroup := v1.Group("users")
userGroup.GET("/", user.User)
userGroup.POST("/", user.User)
userGroup.Any(":id", user.User)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/cheneylau/components.git
git@gitee.com:cheneylau/components.git
cheneylau
components
components
90ff6820d0c6

搜索帮助