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

  1. req.fresh;

Example

  1. if (req.fresh) {
  2. // The user-agent is asking for a more up-to-date version of the requested resource.
  3. // Let's hit the database to get some stuff and send it back.
  4. }

Notes

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