@rill/fresh
Check if a response is fresh and automatically send a 304 (not modified) status.
Installation
npm install @rill/fresh
Example
var fresh = require('@rill/fresh')
var etag = require('@rill/etag')
var rill = require('rill')
var app = rill()
// use it upstream from etag so
// that they are present
app.use(fresh())
// add etags
app.use(etag())
// respond
app.use(function ({ res }, next){
res.body = {
name: 'tobi',
species: 'ferret',
age: 2
}
})
Contributions
- Use
npm test
to run tests.
Please feel free to create a PR!