|
|
|
@ -161,10 +161,6 @@ func frontPageHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
log.Printf("%s\n", templates.DefinedTemplates())
|
|
|
|
|
// Using function literal and closures to handle not found
|
|
|
|
|
// http.HandleFunc("/view/", viewHandler)
|
|
|
|
|
// http.HandleFunc("/edit/", editHandler)
|
|
|
|
|
// http.HandleFunc("/save/", saveHandler)
|
|
|
|
|
http.HandleFunc("/view/", makeHandler(viewHandler))
|
|
|
|
|
http.HandleFunc("/edit/", makeHandler(editHandler))
|
|
|
|
|
http.HandleFunc("/save/", makeHandler(saveHandler))
|
|
|
|
@ -173,10 +169,3 @@ func main() {
|
|
|
|
|
log.Println("Serving on: http://0.0.0.0:5001")
|
|
|
|
|
log.Fatal(http.ListenAndServe(":5001", nil))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// func main() {
|
|
|
|
|
// p1 := &Page{Title: "TestPage", Body: []byte("This is a test page.")}
|
|
|
|
|
// p1.save()
|
|
|
|
|
// p2, _ := loadPage("TestPage")
|
|
|
|
|
// fmt.Println(string(p2.Body))
|
|
|
|
|
// }
|
|
|
|
|