()
| 49 | } |
| 50 | |
| 51 | func (a *Api) HandleRequests() { |
| 52 | router := mux.NewRouter().StrictSlash(true) |
| 53 | router.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Hello")) }) |
| 54 | router.HandleFunc("/v1/dashboard", a.handleDashboard).Queries("filter", "{filter}") |
| 55 | router.HandleFunc("/v1/dashboard", a.handleDashboard) |
| 56 | log.Info("Starting API", "address", a.address) |
| 57 | http.ListenAndServe(a.address, router) |
| 58 | } |
| 59 | |
| 60 | type client struct { |
| 61 | Name string `json:"name"` |