From 9288faf23a78cb48bfab22c02447bce5753fa104 Mon Sep 17 00:00:00 2001
From: early
Date: Mon, 2 Sep 2024 12:44:57 -0600
Subject: [PATCH] add more tools for static support
---
cmd/standard-test/main.go | 6 ++++--
cmd/standard-test/{ => pages}/index.html | 2 ++
cmd/standard-test/pages/static.html | 16 ++++++++++++++++
3 files changed, 22 insertions(+), 2 deletions(-)
rename cmd/standard-test/{ => pages}/index.html (88%)
create mode 100644 cmd/standard-test/pages/static.html
diff --git a/cmd/standard-test/main.go b/cmd/standard-test/main.go
index 43a1495..88fad7c 100644
--- a/cmd/standard-test/main.go
+++ b/cmd/standard-test/main.go
@@ -20,7 +20,7 @@ var Thing = part.New("test-thing", "test_thing.html",
}),
)
-var Page = page.New("index", "index.html",
+var Page = page.New("index", "pages/index.html",
page.Includes(
stdpart.ContactForm([]string{"Feedback"}), Thing,
),
@@ -33,15 +33,17 @@ var Page = page.New("index", "index.html",
return out
},
}),
- page.Pretty(" "),
)
+var Static = page.Static("pages/static.html")
+
func main() {
app := tapp.New()
tapp.GetEnv().Apply(app)
app.ShutdownOnSignal(syscall.SIGINT, syscall.SIGTERM)
app.Handle("GET /{$}", Page)
+ app.Handle("GET /static", Static)
app.Handle("GET /", http.FileServer(http.Dir("public")))
app.Handle("GET /contact", stdpart.HandleContactForm(nil, stdpart.PrintContact))
app.Handle("POST /contact", stdpart.HandleContactForm(nil, stdpart.PrintContact))
diff --git a/cmd/standard-test/index.html b/cmd/standard-test/pages/index.html
similarity index 88%
rename from cmd/standard-test/index.html
rename to cmd/standard-test/pages/index.html
index bb6af6c..b7a2f80 100644
--- a/cmd/standard-test/index.html
+++ b/cmd/standard-test/pages/index.html
@@ -14,6 +14,8 @@
{{- range $i, $v := SliceOfLen 5 }}
{{ end -}}
+
+ Link to static page
+
+ This is a normal static page.
+ It doesn't do anything except exist. Neat.
+
+
diff --git a/cmd/standard-test/pages/static.html b/cmd/standard-test/pages/static.html
new file mode 100644
index 0000000..e03b202
--- /dev/null
+++ b/cmd/standard-test/pages/static.html
@@ -0,0 +1,16 @@
+
+
+
+