Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/busterc/serve-static-x
:anchor: Serve static files with cache busting capability (uses Express.static() aka serve-static)
https://github.com/busterc/serve-static-x
caching disk-cache express express-middleware
Last synced: about 1 month ago
JSON representation
:anchor: Serve static files with cache busting capability (uses Express.static() aka serve-static)
- Host: GitHub
- URL: https://github.com/busterc/serve-static-x
- Owner: busterc
- License: isc
- Created: 2015-11-08T21:12:26.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-08-25T21:44:36.000Z (over 6 years ago)
- Last Synced: 2024-11-10T13:43:55.787Z (2 months ago)
- Topics: caching, disk-cache, express, express-middleware
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# serve-static-x [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url]
> Serve static files with cache busting capability;
> uses [`Express.static()`](http://expressjs.com/4x/api.html#express.static) aka [serve-static](https://github.com/expressjs/serve-static)Use it just like [serve-static](https://github.com/expressjs/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`](https://github.com/busterc/save-static) for caching and re-caching files to disk.
## Install
```sh
$ npm install --save serve-static-x
```## Usage
```js
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](https://about.me/buster)
[npm-image]: https://badge.fury.io/js/serve-static-x.svg
[npm-url]: https://npmjs.org/package/serve-static-x
[travis-image]: https://travis-ci.org/busterc/serve-static-x.svg?branch=master
[travis-url]: https://travis-ci.org/busterc/serve-static-x
[daviddm-image]: https://david-dm.org/busterc/serve-static-x.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/busterc/serve-static-x