Exemple #1
0
func editHandler(w http.ResponseWriter, r *http.Request, title string) {
	p, err := page.Load(pageSrcLocation, title)
	if err != nil {
		p = &page.Page{Title: title}
	}
	renderPageTemplate(w, "edit", p)
}
Exemple #2
0
func viewHandler(w http.ResponseWriter, r *http.Request, title string) {
	p, err := page.Load(pageLocation, title)
	if err != nil {
		http.Redirect(w, r, "/edit/"+title, http.StatusFound)
		return

	}
	renderPageTemplate(w, "view", p)
}