A very simple cache control middleware for express
MIT License
A very simple cache control middleware for express.
❤️ Awesome Features:
debug
is supported 💪npm install simple-cache-control-middleware
const express = require('express');
const simpleCacheControlMiddleware = require('simple-cache-control-middleware')
const app = express();
app.use(simpleCacheControlMiddleware())
app.get('/', (req, res) => {
res.send(`This request has 5m max-age`);
});
app.post('/', (req, res) => {
res.send(`This request is not cached`);
});
app.listen(3000, () => {
console.log('We are in port 3000!');
});
const express = require('express');
const simpleCacheControlMiddleware = require('simple-cache-control-middleware')
const app = express();
const TEN_MINUTES = 60 * 10
app.use(simpleCacheControlMiddleware({
maxAge: TEN_MINUTES
}))
Development only:
Production only:
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
See also the list of contributors who participated in this project.
This project is licensed under the GNU AGPL3.0 License - see the LICENSE.md file for details
Heavily inspired in RegBrain | Cache headers in Express js app post