diff options
Diffstat (limited to 'src/hub/src/spreadspace.org/sfive/s5srvWeb.go')
-rw-r--r-- | src/hub/src/spreadspace.org/sfive/s5srvWeb.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/hub/src/spreadspace.org/sfive/s5srvWeb.go b/src/hub/src/spreadspace.org/sfive/s5srvWeb.go index 7adbb81..31964ad 100644 --- a/src/hub/src/spreadspace.org/sfive/s5srvWeb.go +++ b/src/hub/src/spreadspace.org/sfive/s5srvWeb.go @@ -5,6 +5,7 @@ import ( "fmt" "io/ioutil" "net/http" + "os" "strconv" "time" @@ -180,7 +181,15 @@ func (self StatsSinkServer) getStats(c web.C, w http.ResponseWriter, r *http.Req fmt.Fprintf(w, "%s", jsonString) } -func (self StatsSinkServer) ServeWeb() { +func (self StatsSinkServer) ServeWeb(vizAppLocation string) { + if _, err := os.Stat(vizAppLocation); err != nil { + if os.IsNotExist(err) { + s5l.Panicf("web: viz-app at %s does not exist.", vizAppLocation) + } else { + s5l.Printf("web: failed to stat %s: %v", vizAppLocation, err) + } + } + goji.Get("/hello/:name", hello) goji.Get("/tags", self.getTagList) goji.Get("/sources", self.getSourcesList) @@ -189,5 +198,7 @@ func (self StatsSinkServer) ServeWeb() { goji.Get("/updates/:id", self.getUpdate) goji.Post("/updates", self.postUpdate) goji.Get("/stats", self.getStats) + goji.Handle("/viz/*", http.StripPrefix("/viz/", http.FileServer(http.Dir(vizAppLocation)))) + goji.Serve() } |