1 Star 0 Fork 0

肖金光 / goclean

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
http.go 601 Bytes
一键复制 编辑 原始数据 按行查看 历史
xiaojg-mbp 提交于 2024-01-11 16:56 . go11添加中间件认证
package api
import (
"gitee.com/aviptle/goclean/go11jin/vblog01/apps/user"
"gitee.com/aviptle/goclean/go11jin/vblog01/ioc"
"github.com/gin-gonic/gin"
)
type Handler struct {
svc user.Service
}
// 让他从Ioc中获取依赖的对象
func (h *Handler) Init() error {
h.svc = ioc.GetController(user.Appname).(user.Service)
return nil
}
func (h *Handler) Name() string {
return user.Appname
}
func (h *Handler) Registry(r gin.IRouter) {
// subrouter的前缀: "/vblog/api/v1/users"
// /vblog/api/v1/users/login
r.POST("/login", h.Login)
}
func init() {
ioc.RegistryHttpApi(&Handler{})
}
Go
1
https://gitee.com/aviptle/goclean.git
git@gitee.com:aviptle/goclean.git
aviptle
goclean
goclean
12c2583204a6

搜索帮助