上QQ阅读APP看书,第一时间看更新
The main method
The main method handles the Home, Alter, Create, Update, View, Insert, and Delete functions with different aliases for lookup and renders the templates appropriately. HttpServer listens to port 8000 and waits for template alias invocation:
// main method
func main() {
log.Println("Server started on: http://localhost:8000")
http.HandleFunc("/", Home)
http.HandleFunc("/alter", Alter)
http.HandleFunc("/create", Create)
http.HandleFunc("/update", Update)
http.HandleFunc("/view", View)
http.HandleFunc("/insert", Insert)
http.HandleFunc("/delete", Delete)
http.ListenAndServe(":8000", nil)
}
Let's take a look at the Header, Footer, Menu, Create, Update, and View templates in the following sections.