From 482c293dec85ae71e356276e0b5e5adcd52b75b7 Mon Sep 17 00:00:00 2001 From: Wancat Date: Tue, 18 Oct 2022 03:04:33 +0800 Subject: [PATCH] List tx templates on homepage --- main.go | 4 ++-- index.html => templates/index.html | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) rename index.html => templates/index.html (52%) diff --git a/main.go b/main.go index 792c167..19d8d47 100644 --- a/main.go +++ b/main.go @@ -22,7 +22,7 @@ type TxData struct { func init() { var err error - tpl, err = template.ParseGlob("templates/*.txt") + tpl, err = template.ParseGlob("templates/*") if err != nil { panic(err) } @@ -33,7 +33,7 @@ func main() { fmt.Println("Hi") http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - http.ServeFile(w, r, "index.html") + tpl.ExecuteTemplate(w, "index.html", tpl) }) http.HandleFunc("/action", func(w http.ResponseWriter, r *http.Request) { diff --git a/index.html b/templates/index.html similarity index 52% rename from index.html rename to templates/index.html index 0da3610..900d8b7 100644 --- a/index.html +++ b/templates/index.html @@ -6,7 +6,13 @@

Ledger Quick Note

- +