feat(server): insert the mod path

This commit is contained in:
Brandon Philips
2013-10-16 18:59:25 -07:00
parent 56bbab74ca
commit 5620f88635
3 changed files with 17 additions and 4 deletions

View File

@ -3,13 +3,16 @@ package mod
import (
"net/http"
"github.com/coreos/etcd/mod/dashboard"
"github.com/gorilla/mux"
)
var ServeMux *http.Handler
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
func HttpHandler() (handler http.Handler) {
modMux := mux.NewRouter()
modMux.PathPrefix("/dashboard/").
Handler(http.StripPrefix("/dashboard/", dashboard.HttpHandler()))
return modMux
}