diff options
Diffstat (limited to 'website.go')
-rw-r--r-- | website.go | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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) +} |