mirror of
https://github.com/status-im/fathom.git
synced 2025-03-01 11:30:28 +00:00
18 lines
417 B
Go
18 lines
417 B
Go
package api
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/usefathom/fathom/pkg/datastore"
|
|
)
|
|
|
|
// URL: /api/stats/referrer
|
|
var GetReferrerStatsHandler = HandlerFunc(func(w http.ResponseWriter, r *http.Request) error {
|
|
params := GetRequestParams(r)
|
|
result, err := datastore.GetAggregatedReferrerStats(params.StartDate, params.EndDate, params.Limit)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return respond(w, envelope{Data: result})
|
|
})
|