Skip to content

johangu/restify-cache-headers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

restify-cache-headers

Automatically creates a cache of ETags upon a request of a changed route in a restify application and adds ETag and Last-Modified headers to the response.

Created to work with restify.plugins.conditionalRequest()

Installation

npm i restify-cache-headers

Usage

const restify = require('restify')
const etagCache = require('restify-cache-headers')

const server = restify.createServer()

// IMPORTANT: Include the check before conditionalRequest plugin
server.use(etagCache.check([options]))
server.use(restify.plugins.conditionalRequest())

// This listener is needed to add previously uncached ETags to the cache
server.on('after', etagCache.write())

Options

Passed onto etag

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published