Skip to content
/ fresh Public

๐ŸŒ HTTP response freshness testing middleware for Rill.

Notifications You must be signed in to change notification settings

rill-js/fresh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Rill
@rill/fresh
API stability Standard NPM version Downloads Gitter Chat

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!

About

๐ŸŒ HTTP response freshness testing middleware for Rill.

Resources

Stars

Watchers

Forks

Packages

No packages published