fix no default index page

This commit is contained in:
mappu 2017-10-08 16:54:26 +13:00
parent e9fbfd0277
commit 75c3a98f33

View File

@ -112,6 +112,9 @@ func (this *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set(`Access-Control-Allow-Origin`, `*`)
w.WriteHeader(200)
} else if r.Method == "GET" && r.URL.Path == `/` {
http.Redirect(w, r, `/index.html`, http.StatusFound)
} else if static, err := Asset(r.URL.Path[1:]); err == nil && r.Method == "GET" {
http.ServeContent(w, r, r.URL.Path[1:], this.startTime, bytes.NewReader(static))