From 0b2d3ea6c07d6076611075a24688d53610327697 Mon Sep 17 00:00:00 2001 From: Alex Ellis Date: Wed, 3 May 2017 21:49:59 +0100 Subject: [PATCH] Move static files to ui folder --- gateway/server.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gateway/server.go b/gateway/server.go index 51bf2abd..53053b1e 100644 --- a/gateway/server.go +++ b/gateway/server.go @@ -45,13 +45,17 @@ func main() { r.HandleFunc("/system/functions", faasHandlers.MakeNewFunctionHandler(metricsOptions, dockerClient)).Methods("POST") r.HandleFunc("/system/functions", faasHandlers.MakeDeleteFunctionHandler(metricsOptions, dockerClient)).Methods("DELETE") + fs := http.FileServer(http.Dir("./assets/")) + r.PathPrefix("/ui/").Handler(http.StripPrefix("/ui", fs)).Methods("GET") + r.HandleFunc("/", faasHandlers.MakeProxy(metricsOptions, false, dockerClient, &logger)).Methods("POST") metricsHandler := metrics.PrometheusHandler() r.Handle("/metrics", metricsHandler) metrics.AttachSwarmWatcher(dockerClient, metricsOptions) - r.PathPrefix("/").Handler(http.FileServer(http.Dir("./assets/"))).Methods("GET") + r.Handle("/", http.RedirectHandler("/ui/", http.StatusMovedPermanently)).Methods("GET") + s := &http.Server{ Addr: ":8080", ReadTimeout: 8 * time.Second,