Skip to content

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

License

Notifications You must be signed in to change notification settings

busterc/serve-static-x

Repository files navigation

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published