move templates to web dir

This commit is contained in:
2025-01-02 15:13:13 +01:00
parent 59222160af
commit 7798930145
5 changed files with 5 additions and 5 deletions

View File

@@ -40,7 +40,7 @@ func UpSearch(w http.ResponseWriter, req *http.Request) {
}
// retrieve from repo
fds, _ := data.NewFileDatastore("./persistence/spiegel100.json")
fds, _ := data.NewFileDatastore("persistence/spiegel100.json")
if err != nil { http.Error(w, "Failed to read datastore", http.StatusInternalServerError); return; }
repo, _ := data.NewDefaultRepository[*model.Article](fds, "article")
@@ -62,7 +62,7 @@ func UpSearch(w http.ResponseWriter, req *http.Request) {
}
// render template
t := template.Must(template.ParseFiles("templates/article.html"))
t := template.Must(template.ParseFiles("web/templates/article.html"))
err = t.ExecuteTemplate(w, "content", articleVMs)
if err != nil { http.Error(w, "Failed to render template", http.StatusInternalServerError); return; }
}