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
798 B

  1. package webserver
  2. import (
  3. "log"
  4. "net/http"
  5. "git.tovijaeschke.xyz/tovi/personal_website/database"
  6. )
  7. func ViewIndex(w http.ResponseWriter, r *http.Request) {
  8. var (
  9. v = make(map[string]interface{})
  10. e error
  11. )
  12. v["PageView"] = "index-intro.gohtml"
  13. v["Posts"], e = database.GetPostsList(5, 0)
  14. if e != nil {
  15. log.Println(e)
  16. http.Redirect(w, r, "/error", 302)
  17. }
  18. ServeTemplate(w, r, "html/index.gohtml", v)
  19. }
  20. func ViewLinks(w http.ResponseWriter, r *http.Request) {
  21. var (
  22. v = make(map[string]interface{})
  23. )
  24. v["PageView"] = "index-links.gohtml"
  25. ServeTemplate(w, r, "html/index.gohtml", v)
  26. }
  27. func ViewError(w http.ResponseWriter, r *http.Request) {
  28. var (
  29. v = make(map[string]interface{})
  30. )
  31. v["PageView"] = "error.gohtml"
  32. ServeTemplate(w, r, "html/index.gohtml", v)
  33. }