diff --git a/web/static/index.html b/assets/static/index.html similarity index 100% rename from web/static/index.html rename to assets/static/index.html diff --git a/web/templates/article.html b/assets/templates/article.html similarity index 100% rename from web/templates/article.html rename to assets/templates/article.html diff --git a/web/templates/layout.html b/assets/templates/layout.html similarity index 100% rename from web/templates/layout.html rename to assets/templates/layout.html diff --git a/cmd/frontend/main.go b/cmd/frontend/main.go index f09f979..239182d 100644 --- a/cmd/frontend/main.go +++ b/cmd/frontend/main.go @@ -12,7 +12,7 @@ func main() { http.HandleFunc("POST /up/search", routes.UpSearch) // serve files from the "static" directory - fs := http.FileServer(http.Dir("web/static")) + fs := http.FileServer(http.Dir("assets/static")) http.Handle("GET /static/", http.StripPrefix("/", fs)) // start server diff --git a/internal/routes/Index.go b/internal/routes/Index.go index ca79d06..f1531e2 100644 --- a/internal/routes/Index.go +++ b/internal/routes/Index.go @@ -36,7 +36,7 @@ func Index(w http.ResponseWriter, req *http.Request) { } // render template - t := template.Must(template.ParseFiles("web/templates/article.html", "web/templates/layout.html")) + t := template.Must(template.ParseFiles("assets/templates/article.html", "assets/templates/layout.html")) err = t.ExecuteTemplate(w, "base", articleVMs) if err != nil { http.Error(w, "Failed to render template", http.StatusInternalServerError); return; } } diff --git a/internal/routes/UpSearch.go b/internal/routes/UpSearch.go index 63fa390..5713dfb 100644 --- a/internal/routes/UpSearch.go +++ b/internal/routes/UpSearch.go @@ -62,7 +62,7 @@ func UpSearch(w http.ResponseWriter, req *http.Request) { } // render template - t := template.Must(template.ParseFiles("web/templates/article.html")) + t := template.Must(template.ParseFiles("assets/templates/article.html")) err = t.ExecuteTemplate(w, "content", articleVMs) if err != nil { http.Error(w, "Failed to render template", http.StatusInternalServerError); return; } }