(seconds int, next http.HandlerFunc)
| 9 | ) |
| 10 | |
| 11 | func cached(seconds int, next http.HandlerFunc) http.HandlerFunc { |
| 12 | return func(w http.ResponseWriter, r *http.Request) { |
| 13 | w.Header().Add("Cache-Control", fmt.Sprintf("public, max-age=%d", seconds)) |
| 14 | w.Header().Add("Expires", fmt.Sprintf("%d", seconds)) |
| 15 | next.ServeHTTP(w, r) |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | func (api *API) setupServerRoutes() { |
| 20 | log.Debug("registering server api ...") |