diff --git a/server b/server index a28657a..9a1dcbd 100755 Binary files a/server and b/server differ diff --git a/server.go b/server.go index 00d3595..6fc688c 100644 --- a/server.go +++ b/server.go @@ -47,7 +47,6 @@ func main() { if err := http.ListenAndServe(conf.HTTP.Address, r); err != nil { panic(errors.Wrapf(err, "error while listening on '%s'", conf.HTTP.Address)) } - } // ServerHTTP is the entry point to all requests @@ -104,12 +103,18 @@ func LogInPage(w http.ResponseWriter, r *http.Request) { // HomePage is the homepage of the app func HomePage(w http.ResponseWriter, r *http.Request) { - foods := foodlist.GetFoodOfTheDay() + type HomeData struct { + Foods foodlist.FoodOfTheDay + Votes vote.VotesOfTheDay + } + + datas := HomeData{foodlist.GetFoodOfTheDay(), vote.GetVotesOfTheDay()} + paths := []string{ "./templates/index.tmpl", } t := template.Must(template.New("index.tmpl").ParseFiles(paths...)) - err := t.Execute(w, foods) + err := t.Execute(w, datas) if err != nil { log.Printf("\nExecute error: %v", err) return diff --git a/templates/index.tmpl b/templates/index.tmpl index ec44103..a72a719 100644 --- a/templates/index.tmpl +++ b/templates/index.tmpl @@ -7,27 +7,37 @@ - +
-

Foodoles - {{.Date}}


+

Foodoles - {{.Foods.Date}}


Pick Your Preferred Lunch's Food For Today


- -