aboutsummaryrefslogtreecommitdiffstats
path: root/website.go
diff options
context:
space:
mode:
authorclsr <clsr@clsr.net>2016-06-16 20:38:38 +0200
committerclsr <clsr@clsr.net>2016-06-16 20:38:38 +0200
commit1c9d6da3900951179c12d7942eb149a4d9f11630 (patch)
tree8b1b5810eed9a7eb1411cce6ab1227bccc514a55 /website.go
parenteb178593f03bf84b4d1a52eb77f6d37cf2e3729f (diff)
downloadgomf-1c9d6da3900951179c12d7942eb149a4d9f11630.tar.gz
gomf-1c9d6da3900951179c12d7942eb149a4d9f11630.zip
Move handleGrill from api.go to website.go
Diffstat (limited to 'website.go')
-rw-r--r--website.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/website.go b/website.go
index a917979..3cc30fc 100644
--- a/website.go
+++ b/website.go
@@ -92,3 +92,12 @@ func handlePage(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(os.Stderr, err)
}
}
+
+func handleGrill(w http.ResponseWriter, r *http.Request) {
+ grills, err := ioutil.ReadDir("static/grill/")
+ if err != nil {
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+ http.Redirect(w, r, "/static/grill/"+grills[rand.Intn(len(grills))].Name(), http.StatusFound)
+}