Beispiel #1
0
func main() {
	r := mux.NewRouter()
	r.HandleFunc("/", HomeHandler)

	// Add csrf middleware.
	http.ListenAndServe(":8000",
		csrf.Protect([]byte("32-byte-long-auth-key"), csrf.Secure(false))(r))
}
Beispiel #2
0
func main() {
	flag.StringVar(&port, "p", "8000", "port to run the server on")
	flag.Parse()

	r := mux.NewRouter()
	r.HandleFunc("/", HomeHandler)

	log.Println("Listen and serving at 127.0.0.1:" + port)

	// Add csrf middleware.
	http.ListenAndServe(":"+port,
		csrf.Protect([]byte("32-byte-long-auth-key"), csrf.Secure(false))(r))
}