//EditController contains logic for the Edit action func EditController(w http.ResponseWriter, r *http.Request, title string) { p, err := models.LoadPage(title) if err != nil { p = &models.Page{Title: title} } helpers.RenderView(w, "edit", p) }
//ViewController contains logic for the View action func ViewController(w http.ResponseWriter, r *http.Request, title string) { p, err := models.LoadPage(title) if err != nil { http.Redirect(w, r, "/edit/"+title, http.StatusFound) return } helpers.RenderView(w, "view", p) }