From c1e8ee336d4888886c3e33ae7cea91a6ca19693b Mon Sep 17 00:00:00 2001 From: awstin Date: Thu, 2 Oct 2025 22:14:22 -0400 Subject: [PATCH] Adding static file handling --- galley.go | 1 + tmpl/view.html | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/galley.go b/galley.go index 86d7259..768addc 100644 --- a/galley.go +++ b/galley.go @@ -14,6 +14,7 @@ var templates = template.Must(template.ParseFiles("tmpl/edit.html", "tmpl/view.h var validPath = regexp.MustCompile("^/(edit|save|view)/([a-zA-Z0-9]+)$") func main() { + http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static")))) http.HandleFunc("/view/", makeHandler(viewHandler)) http.HandleFunc("/edit/", makeHandler(editHandler)) http.HandleFunc("/save/", makeHandler(saveHandler)) diff --git a/tmpl/view.html b/tmpl/view.html index be7879b..cce29cf 100644 --- a/tmpl/view.html +++ b/tmpl/view.html @@ -1,3 +1,14 @@ -

{{.Title}}

-

[edit]

-
{{printf "%s" .Body}}
+ + + + + + + + +

{{.Title}}

+

[edit]

+
{{printf "%s" .Body}}
+ + +