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.

46 lines
1.1 KiB

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