forked from OrgGo/Tasks
handled change in template extension
This commit is contained in:
parent
872eb2967d
commit
3a5098fcc1
12
main.go
12
main.go
|
@ -30,7 +30,7 @@ func main() {
|
||||||
files, err := ioutil.ReadDir("./templates")
|
files, err := ioutil.ReadDir("./templates")
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
filename := file.Name()
|
filename := file.Name()
|
||||||
if strings.HasSuffix(filename, ".gtpl") {
|
if strings.HasSuffix(filename, ".html") {
|
||||||
allFiles = append(allFiles, "./templates/"+filename)
|
allFiles = append(allFiles, "./templates/"+filename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,12 +39,12 @@ func main() {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
templates, err = template.ParseFiles(allFiles...)
|
templates, err = template.ParseFiles(allFiles...)
|
||||||
homeTemplate = templates.Lookup("home.gtpl")
|
homeTemplate = templates.Lookup("home.html")
|
||||||
deletedTemplate = templates.Lookup("deleted.gtpl")
|
deletedTemplate = templates.Lookup("deleted.html")
|
||||||
|
|
||||||
editTemplate = templates.Lookup("edit.gtpl")
|
editTemplate = templates.Lookup("edit.html")
|
||||||
searchTemplate = templates.Lookup("search.gtpl")
|
searchTemplate = templates.Lookup("search.html")
|
||||||
completedTemplate = templates.Lookup("completed.gtpl")
|
completedTemplate = templates.Lookup("completed.html")
|
||||||
|
|
||||||
router := httprouter.New()
|
router := httprouter.New()
|
||||||
router.GET("/", ShowAllTasks)
|
router.GET("/", ShowAllTasks)
|
||||||
|
|
Loading…
Reference in New Issue