示例#1
0
文件: main.go 项目: janit/http2status
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))
}
示例#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))
}