move templates to web dir
This commit is contained in:
@@ -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; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user