(mux *http.ServeMux)
| 20 | } |
| 21 | |
| 22 | func (h *Handler) RegisterRoutes(mux *http.ServeMux) { |
| 23 | publicFS, _ := fs.Sub(h.assets, "public") |
| 24 | mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(publicFS)))) |
| 25 | |
| 26 | mux.HandleFunc("/", h.handleIndex) |
| 27 | mux.HandleFunc("/favicon.ico", h.handleFavicon) |
| 28 | mux.HandleFunc("/api/data", h.handleGetData) |
| 29 | mux.HandleFunc("/api/items/", h.handleGetItem) |
| 30 | } |
| 31 | |
| 32 | func (h *Handler) handleIndex(w http.ResponseWriter, r *http.Request) { |
| 33 | if r.URL.Path != "/" { |