天天看點

[one day one question] express 不緩存如何實作

問題描述:

  express 預設緩存,這怎麼破?

解決方案:

apiRoutes.use(function (req, res, next) {
  res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
  res.setHeader('Pragma', 'no-cache');
  res.setHeader('Expires', '0');
  next();
});
           

更多專業前端知識,請上 【猿2048】www.mk2048.com