diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/web/handlers.go | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/cmd/web/handlers.go b/cmd/web/handlers.go index 1f3a58f..b0e83ac 100644 --- a/cmd/web/handlers.go +++ b/cmd/web/handlers.go @@ -39,22 +39,32 @@ func (app *application) home(w http.ResponseWriter, r *http.Request) { return } - files := []string{ - "./ui/html/base.tmpl.html", - "./ui/html/pages/home.tmpl.html", - "./ui/html/partials/nav.tmpl.html", - } - - ts, err := template.ParseFiles(files...) + organisations, err := app.organisations.Latest() if err != nil { - app.serverError(w, r, err) // Use the serverError() helper + app.serverError(w, r, err) return } - err = ts.ExecuteTemplate(w, "base", nil) - if err != nil { - app.serverError(w, r, err) // Use the serverError() helper + for _, organisation := range organisations { + fmt.Fprintf(w, "%+v\n", organisation) } + + // files := []string{ + // "./ui/html/base.tmpl.html", + // "./ui/html/pages/home.tmpl.html", + // "./ui/html/partials/nav.tmpl.html", + // } + // + // ts, err := template.ParseFiles(files...) + // if err != nil { + // app.serverError(w, r, err) // Use the serverError() helper + // return + // } + // + // err = ts.ExecuteTemplate(w, "base", nil) + // if err != nil { + // app.serverError(w, r, err) // Use the serverError() helper + // } } func (app *application) organisationView(w http.ResponseWriter, r *http.Request) { |