studygolang filter模块阅读小结

whispermemory · · 5404 次点击
whispermemory
一份代码不是变得越来越好,就是变得越来越差。
1>  生成 http Router router := initRouter() http.Handle("/", router) 这样 http 走到 / 的时候会调用 router ServeHTTP 方法 2> router ServeHTTP 方法 func (r *Router) ServeHTTP(w,r) { //根据 uri 查找路由 map // 获取 handler // 调用 handler hanlder.ServeHTTP() }
#2
更多评论
HanlderFunc执行时,会自动调用ServeHTTP吗,依据的是什么原理?
#1
whispermemory
一份代码不是变得越来越好,就是变得越来越差。
2> router ServeHTTP 方法 func (r *Router) ServeHTTP(w,r) { //根据 uri 查找路由 map // 获取 handler // 调用 handler hanlder.ServeHTTP() }
#3