diff options
Diffstat (limited to 'cmd/web/handlers.go')
-rw-r--r-- | cmd/web/handlers.go | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/cmd/web/handlers.go b/cmd/web/handlers.go index fd70c5e..8df8928 100644 --- a/cmd/web/handlers.go +++ b/cmd/web/handlers.go @@ -18,11 +18,30 @@ func (app *application) serverError(w http.ResponseWriter, r *http.Request, err trace = string(debug.Stack()) ) - // TODO: reintroduce: app.logger.Error(err.Error(), "method", method, "uri", uri, "trace", trace) + app.logger.Error(err.Error(), "method", method, "uri", uri, "trace", trace) log.Printf("Crash! %s %s %s", method, uri, trace) http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) } +func (app *application) listOrganisation(w http.ResponseWriter, r *http.Request) { + files := []string{ + "./ui/html/base.tmpl.html", + "./ui/html/pages/organisations/list.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) home(w http.ResponseWriter, r *http.Request) { if r.URL.Path != "/" { app.notFound(w) |