Remove trailing slash from RootPath output string

This commit is contained in:
Ken Hibino
2021-10-14 15:50:07 -07:00
parent aaa3147fbb
commit 3723433895
2 changed files with 4 additions and 2 deletions

View File

@@ -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))

View File

@@ -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/*