package main import ( "flag" "log" "net/http" ) // main it's the snippetbox webapp func main() { //configuration addr := flag.String("addr", ":4000", "HTTP network address") flag.Parse() mux := http.NewServeMux() // setup server for static files fileServer := http.FileServer(http.Dir("./ui/static")) mux.Handle("/static/", http.StripPrefix("/static", fileServer)) mux.HandleFunc("/", home) mux.HandleFunc("/snippet/view", snippetView) mux.HandleFunc("/snippet/create", snippetCreate) log.Printf("starting a server on %s", *addr) err := http.ListenAndServe(*addr, mux) log.Fatal(err) }