summaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorsiddharth ravikumar <s@ricketyspace.net>2022-06-18 08:32:04 -0400
committersiddharth ravikumar <s@ricketyspace.net>2022-06-18 08:32:04 -0400
commite416310ae81a1ecc648c3ae59f6f46326880e818 (patch)
tree0c5bdde0ccb1134668b487e6817b8692bb53b59b /main.go
parent4f121d3a90ae2b7c79cc06df93ab25504a76892b (diff)
peach: add `/about` section
Initial version.
Diffstat (limited to 'main.go')
-rw-r--r--main.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/main.go b/main.go
index ed988c9..79071e8 100644
--- a/main.go
+++ b/main.go
@@ -13,6 +13,7 @@ import (
"regexp"
"strconv"
+ "ricketyspace.net/peach/meta"
"ricketyspace.net/peach/search"
"ricketyspace.net/peach/version"
"ricketyspace.net/peach/weather"
@@ -52,6 +53,9 @@ func main() {
// Search handler.
http.HandleFunc("/search", showSearch)
+ // Meta handler.
+ http.HandleFunc("/about", showMeta)
+
// Start server
log.Fatal(http.ListenAndServe(peachAddr, nil))
}
@@ -100,6 +104,20 @@ func showWeather(w http.ResponseWriter, lat, lng float32) {
}
}
+func showMeta(w http.ResponseWriter, r *http.Request) {
+ logRequest(r)
+
+ // Make meta info.
+ meta := meta.NewMeta()
+
+ // Render.
+ err := peachTemplates.ExecuteTemplate(w, "about.tmpl", meta)
+ if err != nil {
+ log.Printf("weather: template: %v", err)
+ return
+ }
+}
+
func serveStaticFile(w http.ResponseWriter, r *http.Request) {
logRequest(r)