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