1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 09:37:02 +00:00

rest: Use a subrouter for /api/ paths

This commit is contained in:
James Hillyerd
2018-10-22 10:48:08 -07:00
parent 1a7e47b60a
commit 82e6a9fe5d
3 changed files with 10 additions and 11 deletions

View File

@@ -43,7 +43,6 @@ func setupWebServer(mm message.Manager) *bytes.Buffer {
log.SetOutput(buf)
// Have to reset default mux to prevent duplicate routes
http.DefaultServeMux = http.NewServeMux()
cfg := &config.Root{
Web: config.Web{
UIDir: "../ui",
@@ -51,7 +50,7 @@ func setupWebServer(mm message.Manager) *bytes.Buffer {
}
shutdownChan := make(chan bool)
web.Initialize(cfg, shutdownChan, mm, &msghub.Hub{})
SetupRoutes(web.Router)
SetupRoutes(web.Router.PathPrefix("/api/").Subrouter())
return buf
}