Contains the Concourse pipeline definition for building a line-server container
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
866 B

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. package main
  2. import (
  3. "net/http"
  4. "github.com/flosch/pongo2"
  5. "github.com/zenazn/goji/web"
  6. )
  7. var indexTpl = pongo2.Must(pongo2.FromCache("templates/index.html"))
  8. var notFoundTpl = pongo2.Must(pongo2.FromCache("templates/404.html"))
  9. var oopsTpl = pongo2.Must(pongo2.FromCache("templates/oops.html"))
  10. func indexHandler(c web.C, w http.ResponseWriter, r *http.Request) {
  11. err := indexTpl.ExecuteWriter(pongo2.Context{}, w)
  12. if err != nil {
  13. http.Error(w, err.Error(), http.StatusInternalServerError)
  14. }
  15. }
  16. func notFoundHandler(c web.C, w http.ResponseWriter, r *http.Request) {
  17. w.WriteHeader(404)
  18. err := notFoundTpl.ExecuteWriter(pongo2.Context{}, w)
  19. if err != nil {
  20. oopsHandler(c, w, r)
  21. }
  22. }
  23. func oopsHandler(c web.C, w http.ResponseWriter, r *http.Request) {
  24. err := oopsTpl.ExecuteWriter(pongo2.Context{}, w)
  25. if err != nil {
  26. oopsHandler(c, w, r)
  27. }
  28. }