diff --git a/internal/handlers/api/institution.go b/internal/handlers/api/institution.go index 6462960..11e94f0 100644 --- a/internal/handlers/api/institution.go +++ b/internal/handlers/api/institution.go @@ -50,7 +50,7 @@ func (api *API) GetInstitutionHistory(w http.ResponseWriter, r *http.Request) { http.Error(w, "incorrect time amount", http.StatusNotFound) return } - + w.Header().Add("Cache-Control", "max-age=600") if timeFrame == "now" { hist, err := api.dolar.GetLatest(inst) //hist, err := api.db.GetLastPrice(inst) @@ -165,6 +165,7 @@ func (api *API) GetInstNames(w http.ResponseWriter, r *http.Request) { searchResult.Results = append(searchResult.Results, &inst) } api.log.Info("institutions", "list", res) + w.Header().Add("Cache-Control", "max-age=86400") if fType == "html" { switch resource { case "card": @@ -197,10 +198,12 @@ func (api *API) GetLatestPrice(w http.ResponseWriter, r *http.Request) { api.log.Error("geting latest price", "error", err) http.NotFound(w, r) } + w.Header().Add("Cache-Control", "max-age=600") _ = api.templ.ExecuteTemplate(w, "latest-price", price) } func (api *API) GetAllLatestPrice(w http.ResponseWriter, r *http.Request) { + bancos, err := api.dolar.GetInstByType("bancos") if err != nil { api.log.Error("geting inst", "error", err) @@ -225,5 +228,6 @@ func (api *API) GetAllLatestPrice(w http.ResponseWriter, r *http.Request) { } instLastPriceList = append(instLastPriceList, in) } + w.Header().Add("Cache-Control", "max-age=600") _ = api.templ.ExecuteTemplate(w, "latest-price", instLastPriceList) }