June 2017
Beginner
1091 pages
22h 9m
English
We are going to put together an ultra simple web client that consumes the capabilities and data exposed through our API, allowing users to interact with the polling system we built in the previous chapter and earlier in this chapter. Our client will be made up of three web pages:
index.html page that shows all the pollsview.html page that shows the results of a specific pollnew.html page that allows users to create new pollsCreate a new folder called web alongside the api folder and add the following content to the main.go file:
package main import ( "flag" "log" "net/http" ) func main() { var addr = flag.String("addr", ":8081", "website address") flag.Parse() mux := http.NewServeMux() mux.Handle("/", http.StripPrefix("/", ...Read now
Unlock full access