mirror of
https://github.com/status-im/fathom.git
synced 2025-03-01 03:20:27 +00:00
18 lines
402 B
Go
18 lines
402 B
Go
package api
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"github.com/dannyvankooten/ana/count"
|
|
)
|
|
|
|
// URL: /api/browsers
|
|
var GetBrowsersHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
before, after := getRequestedPeriods(r)
|
|
results := count.Browsers(before, after, getRequestedLimit(r))
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|
|
json.NewEncoder(w).Encode(results)
|
|
})
|