Skip to content

新增支持注册go原生http.HandlerFunc形式的函数

Choose a tag to compare

@devfeel devfeel released this 06 Nov 16:19
· 115 commits to master since this release
d564c1d

Version 1.7.5

  • Feature: Router增加RegisterHandlerFunc,用于支持注册go原生http.HandlerFunc形式的函数
  • Feature: HttpServer增加RegisterHandlerFunc与RegisterRoute
  • Opt: Router增加transferHandlerFunc、transferStaticFileHandler辅助函数
  • Example: 修改example/router增加RegisterHandlerFunc示例
  • About RegisterHandlerFunc
    • Func: RegisterHandlerFunc(routeMethod string, path string, handler http.HandlerFunc) RouterNode
  • How to use RegisterHandlerFunc:
func HandlerFunc(w http.ResponseWriter, r *http.Request){
	w.Write([]byte("go raw http func"))
}

server.RegisterHandlerFunc("GET", "/h/func", HandlerFunc)
  • 2019-11-07 01:00 at ShangHai