1.0.0 • Published 1 year ago
simple-cache-control-middleware v1.0.0
About
A very simple cache control middleware for express.
❤️ Awesome Features:
- Easy to define the max-age 🔥
- Only GET Request are cached 🍺
debug
is supported 💪- Easy to use and great test coverage ✅
Usage
Install
npm install simple-cache-control-middleware
Default
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!');
});
Custom max-age
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
}))
Built With
Development only:
Production only:
- debug - Debug the app
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
- Ulises Gascón - *Initial work- - @ulisesGascon
See also the list of contributors who participated in this project.
License
This project is licensed under the GNU AGPL3.0 License - see the LICENSE.md file for details
Acknowledgments
- This project is under development, but you can help us to improve it! We :heart: FOSS!
1.0.0
1 year ago