github.com/bosssauce/ponzu@v0.11.1-0.20200102001432-9bc41b703131/system/api/record.go (about) 1 package api 2 3 import ( 4 "net/http" 5 6 "github.com/ponzu-cms/ponzu/system/api/analytics" 7 ) 8 9 // Record wraps a HandlerFunc to record API requests for analytical purposes 10 func Record(next http.HandlerFunc) http.HandlerFunc { 11 return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { 12 go analytics.Record(req) 13 14 next.ServeHTTP(res, req) 15 }) 16 }