connect-cache-headers

Middleware to set cache headers to responses.

Usage no npm install needed!

<script type="module">
  import connectCacheHeaders from 'https://cdn.skypack.dev/connect-cache-headers';
</script>

README

Overview

Just sets headers to cache, based on the given ''age''.

Install

npm install connect-cache-headers --save

Middleware params

  • age (number)
  • private (boolean)
  • additional directives (array)

Usage

Set max-age and public

app = express()
app.use(require('connect-cache-headers')(1800))

Set max-age and private

app.use(require('connect-cache-headers')(1800, true))