1 Star 0 Fork 0

蔡坚 / gee

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
route.go 488 Bytes
一键复制 编辑 原始数据 按行查看 历史
蔡坚 提交于 2022-11-21 19:09 . init
package gee
import "log"
type router struct {
handlers map[string]HandlerFunc
}
func newRouter() *router {
return &router{handlers: make(map[string]HandlerFunc)}
}
func (r *router) addRouter(method string, pattern string, handler HandlerFunc) {
log.Printf("Route %4s - %s", method, pattern)
key := method + "-" + pattern
r.handlers[key] = handler
}
func (r *router) handle(c *Context) {
key := c.Method + "-" + c.Path
if handler, ok := r.handlers[key]; ok {
handler(c)
}
}
Go
1
https://gitee.com/caijian76/gee.git
git@gitee.com:caijian76/gee.git
caijian76
gee
gee
a322e2c4a6fb

搜索帮助