diff --git a/README.md b/README.md index 38185d5..135c11f 100644 --- a/README.md +++ b/README.md @@ -150,7 +150,8 @@ func main() { RedisConnOpt: asynq.RedisClientOpt{Addr: ":6379"}, }) - http.Handle(h.RootPath(), h) + // Note: We need the tailing slash when using net/http.ServeMux. + http.Handle(h.RootPath()+"/", h) // Go to http://localhost:8080/monitoring to see asynqmon homepage. log.Fatal(http.ListenAndServe(":8080", nil)) diff --git a/handler.go b/handler.go index 4a440e8..0eb7cf6 100644 --- a/handler.go +++ b/handler.go @@ -78,8 +78,9 @@ func (h *HTTPHandler) Close() error { } // RootPath returns the root URL path used for asynqmon application. +// Returned path string does not have the trailing slash. func (h *HTTPHandler) RootPath() string { - return h.rootPath + "/" + return h.rootPath } //go:embed ui/build/*