diff options
author | siddharth ravikumar <s@ricketyspace.net> | 2022-06-18 08:32:04 -0400 |
---|---|---|
committer | siddharth ravikumar <s@ricketyspace.net> | 2022-06-18 08:32:04 -0400 |
commit | e416310ae81a1ecc648c3ae59f6f46326880e818 (patch) | |
tree | 0c5bdde0ccb1134668b487e6817b8692bb53b59b /main.go | |
parent | 4f121d3a90ae2b7c79cc06df93ab25504a76892b (diff) |
peach: add `/about` section
Initial version.
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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) |