From a51cc3903f1eca494fcbb5e2165c242ea0296da8 Mon Sep 17 00:00:00 2001
From: Drew Bednar <drew@androiddrew.com>
Date: Sun, 23 Jun 2024 09:19:19 -0400
Subject: [PATCH] Created template dir

---
 go-web-app/gowiki/TestPage.txt         | 2 +-
 go-web-app/gowiki/{ => tmpl}/edit.html | 0
 go-web-app/gowiki/{ => tmpl}/view.html | 0
 go-web-app/gowiki/wiki.go              | 7 +++++--
 4 files changed, 6 insertions(+), 3 deletions(-)
 rename go-web-app/gowiki/{ => tmpl}/edit.html (100%)
 rename go-web-app/gowiki/{ => tmpl}/view.html (100%)

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]+)$")