示例#1
0
func HttpHandler(addr string) http.Handler {
	r := mux.NewRouter()
	r.HandleFunc("/dashboard", addSlash)
	r.PathPrefix("/dashboard/").Handler(http.StripPrefix("/dashboard/", dashboard.HttpHandler()))

	r.PathPrefix("/v2/lock").Handler(http.StripPrefix("/v2/lock", lock2.NewHandler(addr)))
	r.PathPrefix("/v2/leader").Handler(http.StripPrefix("/v2/leader", leader2.NewHandler(addr)))
	return r
}
示例#2
0
func init() {
	// TODO: Use a Gorilla mux to handle this in 0.2 and remove the strip
	handler := http.StripPrefix("/etcd/mod/dashboard/", dashboard.HttpHandler())
	ServeMux = &handler
}
示例#3
0
文件: mod.go 项目: ronnylt/etcd
func HttpHandler() (handler http.Handler) {
	modMux := mux.NewRouter()
	modMux.PathPrefix("/dashboard/").
		Handler(http.StripPrefix("/dashboard/", dashboard.HttpHandler()))
	return modMux
}