knight是一个Go语言写的HTTP服务器,支持自动重载功能,就是可以自动检测文件的改变并根据需要重启服务器。
用法:
package mainimport ( "fmt" "net/http" "github.com/fengsp/knight")func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "It works!")}func main() { http.HandleFunc("/", handler) // pass your root path in knight := knight.NewKnight("/private/tmp/test") knight.ListenAndServe(":8000", nil)}
评论