diff --git a/go-web-app/gowiki/TestPage.txt b/go-web-app/gowiki/TestPage.txt index a5331a9..26295e5 100644 --- a/go-web-app/gowiki/TestPage.txt +++ b/go-web-app/gowiki/TestPage.txt @@ -1 +1 @@ -This is my fixed test page \ No newline at end of file +This is my fixed test page. Work! \ No newline at end of file diff --git a/go-web-app/gowiki/edit.html b/go-web-app/gowiki/tmpl/edit.html similarity index 100% rename from go-web-app/gowiki/edit.html rename to go-web-app/gowiki/tmpl/edit.html diff --git a/go-web-app/gowiki/view.html b/go-web-app/gowiki/tmpl/view.html similarity index 100% rename from go-web-app/gowiki/view.html rename to go-web-app/gowiki/tmpl/view.html diff --git a/go-web-app/gowiki/wiki.go b/go-web-app/gowiki/wiki.go index ad269b3..f1d325d 100644 --- a/go-web-app/gowiki/wiki.go +++ b/go-web-app/gowiki/wiki.go @@ -1,15 +1,18 @@ package main import ( - "html/template" "log" "net/http" "os" "regexp" + "text/template" ) // Template caching -var templates = template.Must(template.ParseFiles("edit.html", "view.html")) +// var templates = template.Must(template.ParseFiles("edit.html", "view.html")) +var templates = template.Must(template.ParseGlob("./tmpl/*.html")) + +// var templates = template.Must(template.ParseFiles("edit.html", "view.html")) // Validation to prevent abitrary paths var validPath = regexp.MustCompile("^/(edit|save|view)/([a-zA-Z0-9]+)$")