pages.go 351 B

12345678910111213141516171819202122
  1. package pages
  2. import (
  3. "fmt"
  4. "html/template"
  5. "net/http"
  6. "gogs.gildas.ch/gildas/movies"
  7. )
  8. func List(c *movies.Collection) http.HandlerFunc {
  9. return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
  10. t, err := template.ParseFiles("templates/list.html")
  11. if err != nil {
  12. fmt.Println(err)
  13. return
  14. }
  15. t.Execute(w, c)
  16. })
  17. }