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.

39 lines
964 B

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. func indexHandler(c web.C, w http.ResponseWriter, r *http.Request) {
  8. err := Templates["index.html"].ExecuteWriter(pongo2.Context{}, w)
  9. if err != nil {
  10. http.Error(w, err.Error(), http.StatusInternalServerError)
  11. }
  12. }
  13. func notFoundHandler(c web.C, w http.ResponseWriter, r *http.Request) {
  14. w.WriteHeader(404)
  15. err := Templates["404.html"].ExecuteWriter(pongo2.Context{}, w)
  16. if err != nil {
  17. oopsHandler(c, w, r)
  18. }
  19. }
  20. func oopsHandler(c web.C, w http.ResponseWriter, r *http.Request) {
  21. w.WriteHeader(500)
  22. err := Templates["oops.html"].ExecuteWriter(pongo2.Context{}, w)
  23. if err != nil {
  24. oopsHandler(c, w, r)
  25. }
  26. }
  27. func unauthorizedHandler(c web.C, w http.ResponseWriter, r *http.Request) {
  28. w.WriteHeader(401)
  29. err := Templates["401.html"].ExecuteWriter(pongo2.Context{}, w)
  30. if err != nil {
  31. http.Error(w, err.Error(), http.StatusInternalServerError)
  32. }
  33. }