示例#1
0
文件: wiki.go 项目: KaeruCT/go-learn
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)
}
示例#2
0
文件: wiki.go 项目: KaeruCT/go-learn
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)
}