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) {