设为首页 加入收藏

TOP

Fabric区块链浏览器(2)(三)
2023-08-26 21:10:00 】 浏览:153
Tags:Fabric
g, handlers ...HandlerFunc)来进行路由注册:

for _, router := range server.Routers() {
	var handlers []gin.HandlerFunc
	if router.AuthType == 0 {
		router.AuthType = conf.AuthType
	}
	switch router.AuthType {
	case config.Server_BASICAUTH:
		handlers = append(handlers, basicAuth)
	case config.Server_TOKENAUTH:
		handlers = append(handlers, tokenAuth)
	default:
		handlers = append(handlers, noAuth)
	}
	handlers = append(handlers, router.Handler)
	engine.Handle(router.Method, router.Path, handlers...)
}

项目完整代码可以从Github上查看。


孟斯特

声明:本作品采用署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)进行许可,使用时请注明出处。
Author: mengbin
blog: mengbin
Github: mengbin92
cnblogs: 恋水无意


首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Go 并发编程 - Goroutine 基础 (.. 下一篇每日一库:fsnotify简介

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目