serve-static-x

1.0.0 • Public • Published

serve-static-x NPM version Build Status Dependency Status

Serve static files with cache busting capability; uses Express.static() aka serve-static

Use it just like serve-static except now you can set an additional option named "x" that enables a custom (secret) request header to be used to bypass receiving static files.

  • Use in conjunction with save-static for caching and re-caching files to disk.

Install

$ npm install --save serve-static-x

Usage

var express = require('express');
var serveStaticX = require('serve-static-x');
 
var app = express();
 
var staticPath = path.join(__dirname, '/static/html'); // <= for example
 
// this is where the magic happens
app.use(serveStaticX(staticPath, {
  x: 'x-my-secret-cache-busting-header'
}));
 

License

ISC © Buster Collings

Package Sidebar

Install

npm i serve-static-x

Weekly Downloads

1

Version

1.0.0

License

ISC

Last publish

Collaborators

  • buster