From d4ac4409ad88c51f2be2e9075b968941aa8a3f1f Mon Sep 17 00:00:00 2001 From: bytedream Date: Fri, 4 Feb 2022 21:50:19 +0100 Subject: [PATCH] Backend changes for frontend changes --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 0a42465..c73c256 100644 --- a/main.go +++ b/main.go @@ -11,6 +11,7 @@ import ( "net/http" "path" "path/filepath" + "strings" ) func main() { @@ -62,15 +63,16 @@ func setupApi(r *mux.Router) { func setupFrontend(r *mux.Router) { r.HandleFunc("/article/{article}", server.Article).Methods(http.MethodGet) - r.PathPrefix("/sass/").HandlerFunc(server.ServePath) + r.PathPrefix("/css/").HandlerFunc(server.ServePath) r.PathPrefix("/img/").HandlerFunc(server.ServePath) r.PathPrefix("/js/").HandlerFunc(server.ServePath) + r.PathPrefix("/html/").HandlerFunc(server.ServePath) landingpage := template.Must(template.ParseFiles(filepath.Join(config.FrontendDir, "html", "landingpage.gohtml"))) r.Path("/").HandlerFunc(func(w http.ResponseWriter, r *http.Request) { landingpage.Execute(w, struct { BasePath string - }{BasePath: config.Address + path.Join("/", config.SubPath) + "/"}) + }{BasePath: config.Address + strings.TrimSuffix(path.Join("/", config.SubPath), "/") + "/"}) }) r.NotFoundHandler = http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {