givetimetolife

Results 8 comments of givetimetolife

好像是因为字数原因

建议这一章先把代码写一遍 大概清楚每一个方法是做什么的,然后按照 addRouter -> getRouter -> handle 在看一遍代码 走一遍流程就明了多了, 说白了就是 用前缀树结构存 前缀树结构取, 用GET /a/asd/c || GET a/s/c 匹配到路由(GET-/a/:param/c)对应的HandlerFunc 并把asd || s 存在context的Params里. >感谢楼主

之前还奇怪为什么要写 `handler := group.createStaticHandler(relativePath, http.Dir(root)) urlPattern := path.Join(relativePath, "/*filepath")` 后来才发现原来fileHandler.ServeHTTP 会把req.url.path 作为文件路径

请问LoadHTMLGlob LoadHTMLGlob 为什么不写在RouterGroup里。 我没办法这样调用engine.Group("/html1").LoadHTMLGlob

failed to parse int from L: strconv.Atoi: parsing \"L\"