当方JavaScript初心者です。頑張ります。
やりたいこと
AWS Lambdaにより定期的に更新されるJSONファイルをwebサイト側にも反映させたい。
生じていた問題
キャッシュのせいでファイルが更新されたことになっていなかった。
対処
GETリクエストの際に渡すパラメータにタイムスタンプを手動で付与する。
下記コード内での?timestamp=${new Date().getTime()}
の部分です。
setInterval(function update_members(members){
axios.get('URL?timestamp=${new Date().getTime()}',headers)
.then(response => {
res = response.data;
console.log(res);
});
}).catch( error => { console.log(error); });
},10000);