eq performance
This commit is contained in:
@@ -19,8 +19,9 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Job string `json:"job"`
|
||||
Emails []string `json:"emails"`
|
||||
Job string `json:"job"`
|
||||
Emails []string `json:"emails"`
|
||||
NewsSent int `json:"newletter-sent"`
|
||||
}
|
||||
|
||||
func loadConfig() (*Config, error) {
|
||||
@@ -187,6 +188,15 @@ func main() {
|
||||
fmt.Fprintf(w, "%s", strconv.Itoa(len(conf.Emails)))
|
||||
}))
|
||||
|
||||
apiMux.HandleFunc("GET /stats/sent", requireAuth(func(w http.ResponseWriter, r *http.Request) {
|
||||
conf, err := loadConfig()
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
|
||||
}
|
||||
fmt.Fprintf(w, "%s", strconv.Itoa(conf.NewsSent))
|
||||
}))
|
||||
|
||||
// strip /admin/api before handing off
|
||||
adminMux.Handle("/api/", http.StripPrefix("/api", apiMux))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user