q
drew/sql-it
Drew Bednar 7 months ago
parent e28d2c52b7
commit cca682b67e

@ -155,6 +155,10 @@ func saveHandler(w http.ResponseWriter, r *http.Request, title string) {
http.Redirect(w, r, "/view/"+title, http.StatusFound)
}
func frontPageHandler(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, filepath.Join("/view", "FrontPage"), http.StatusFound)
}
func main() {
log.Printf("%s\n", templates.DefinedTemplates())
// Using function literal and closures to handle not found
@ -164,6 +168,7 @@ func main() {
http.HandleFunc("/view/", makeHandler(viewHandler))
http.HandleFunc("/edit/", makeHandler(editHandler))
http.HandleFunc("/save/", makeHandler(saveHandler))
http.HandleFunc("/", frontPageHandler)
log.Println("Serving on: http://0.0.0.0:5001")
log.Fatal(http.ListenAndServe(":5001", nil))

Loading…
Cancel
Save