From d7ed3f684397e207d7ee26a4915e05c71f2e2db2 Mon Sep 17 00:00:00 2001 From: sp Date: Thu, 25 Feb 2021 11:31:47 +1100 Subject: [PATCH] test strip prefix from url "/spa/" in this case to use the test directory --- config.json | 4 ++-- main.go | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/config.json b/config.json index 1862424..cc56ce2 100644 --- a/config.json +++ b/config.json @@ -2,6 +2,6 @@ "Host":"localhost", "Port":"8080", "DocRoot": "./html/", - "StaticUrl": "/", - "StripPrefix" : "/" + "StaticUrl": "/spa/", + "StripPrefix" : "/spa/" } \ No newline at end of file diff --git a/main.go b/main.go index 8aaa338..cdba140 100644 --- a/main.go +++ b/main.go @@ -24,25 +24,25 @@ func main() { func setupRootFileServer() { - fs := http.FileServer(http.Dir(config.DocRoot)) + fs := http.FileServer(http.Dir(config.DocRoot + "test")) http.Handle(config.StaticUrl, http.StripPrefix(config.StripPrefix, fs)) } func setupHTTPHandler() { http.HandleFunc("/api", HelloHandler) - http.HandleFunc("/upload", HelloHandler) - http.HandleFunc("/crmfiles/", HelloHandler) - http.HandleFunc("/dumprequest", HelloHandler) - http.HandleFunc("/MP_verify_6JqVkftKr39GMakA.txt", HelloHandler) - http.HandleFunc("/spa/redirect", HelloHandler) - http.HandleFunc("/iapi/getAccessToken", HelloHandler) - http.HandleFunc("/iapi/createWechatQr", HelloHandler) - http.HandleFunc("/crmpixel.png", HelloHandler) //tracking pixel. - http.HandleFunc("/crmcache", HelloHandler) - http.HandleFunc("/spa/editprofile", HelloHandler) - http.HandleFunc("/spa/livecast", HelloHandler) - http.HandleFunc("/spa/editmeeting", HelloHandler) + //http.HandleFunc("/upload", HelloHandler) + //http.HandleFunc("/crmfiles/", HelloHandler) + //http.HandleFunc("/dumprequest", HelloHandler) + //http.HandleFunc("/MP_verify_6JqVkftKr39GMakA.txt", HelloHandler) + //http.HandleFunc("/spa/redirect", HelloHandler) + //http.HandleFunc("/iapi/getAccessToken", HelloHandler) + //http.HandleFunc("/iapi/createWechatQr", HelloHandler) + //http.HandleFunc("/crmpixel.png", HelloHandler) //tracking pixel. + //http.HandleFunc("/crmcache", HelloHandler) + //http.HandleFunc("/spa/editprofile", HelloHandler) + //http.HandleFunc("/spa/livecast", HelloHandler) + //http.HandleFunc("/spa/editmeeting", HelloHandler) log.Printf("Server started at %s:%s\n", config.Host, config.Port) log.Fatal(http.ListenAndServe(config.Host+":"+config.Port, nil))