req.fresh

A flag indicating 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.