1 Star 0 Fork 0

白开水 / keyauth-zat

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
http.go 981 Bytes
一键复制 编辑 原始数据 按行查看 历史
zat7 提交于 2023-03-02 21:45 . 添加role, policy CRUD
package api
import (
"gitee.com/zat7/keyauth-zat/apps/role"
restfulspec "github.com/emicklei/go-restful-openapi"
"github.com/emicklei/go-restful/v3"
"github.com/infraboard/mcube/app"
"github.com/infraboard/mcube/http/response"
"github.com/infraboard/mcube/logger"
"github.com/infraboard/mcube/logger/zap"
)
var (
h = &handler{}
)
type handler struct {
service role.Service
log logger.Logger
}
func (h *handler) Config() error {
h.log = zap.L().Named(role.AppName)
h.service = app.GetGrpcApp(role.AppName).(role.Service)
return nil
}
func (h *handler) Name() string {
return role.AppName
}
func (h *handler) Version() string {
return "v1"
}
func (h *handler) Registry(ws *restful.WebService) {
tags := []string{h.Name()}
ws.Route(ws.POST("/").To(h.CreateRole).
Doc("create a role").
Metadata(restfulspec.KeyOpenAPITags, tags).
Reads(role.CreateRoleRequest{}).
Writes(response.NewData(role.Role{})))
}
func init() {
app.RegistryRESTfulApp(h)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/zat7/keyauth-zat.git
git@gitee.com:zat7/keyauth-zat.git
zat7
keyauth-zat
keyauth-zat
v0.1.4

搜索帮助

344bd9b3 5694891 D2dac590 5694891