Edit Page

req.fresh

A flag indicating that the user-agent sending this request (req) wants "fresh" data (as indicated by the "if-none-match", "cache-control", and/or "if-modified-since" request headers.)

If the request wants "fresh" data, usually you'll want to .find() fresh data from your models and send it back to the client.

Usage

#
req.fresh;

Example

#
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.
}

Notes

#
  • See the node-fresh module for details specific to the implementation in Sails/Express/Koa/Connect.

Is something missing?

If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the sails repo. Once we merge it, the changes will be reflected on the website the next time it is deployed.

Reference

Reference