コード例 #1
0
ファイル: main.go プロジェクト: flixy/flixy
func main() {
	handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte("hello from " + r.RemoteAddr + "\n"))
	})

	mux := mux.NewRouter()
	mux.Handle("/", handler)

	n := negroni.Classic()
	n.Use(negroni.HandlerFunc(xff.XFF))
	n.UseHandler(mux)
	n.Run(":3000")
}
コード例 #2
0
ファイル: inject.go プロジェクト: flixy/flixy
// Inject adds x-request-id and x-forwarded-for support to an existing negroni instance.
func Inject(n *negroni.Negroni) {
	n.Use(negroni.HandlerFunc(xff.XFF))
	n.Use(xrequestid.New(26))
}