req.fresh
此旗標表示發送此請求 (req
) 的使用者代理程式想要「最新」資料 (由 "if-none-match"、"cache-control" 和/或 "if-modified-since" 請求標頭表示)。
如果請求需要「最新」資料,通常您會希望從您的模型 .find()
最新資料,並將其傳回給客戶端。
req.fresh;
if (req.fresh) {
// The user-agent is asking for a more up-to-date version of the requested resource.
// Let's hit the database to get some stuff and send it back.
}
- 請參閱
node-fresh
模組,以了解 Sails/Express/Koa/Connect 中實作的詳細資訊。
req
)
res
)