Skip to content

Instantly share code, notes, and snippets.

@bradvogel
Last active April 8, 2018 01:54
Show Gist options
  • Save bradvogel/16fb24eb444dfafc8fa4 to your computer and use it in GitHub Desktop.
Save bradvogel/16fb24eb444dfafc8fa4 to your computer and use it in GitHub Desktop.
/**
* Run this by downloading this script to your computer, then:
* 1. $ npm install express
* 2. $ node thisscript.js
* 3. Open localhost:8030/nocache and then localhost:8030/nostore
*/
var app = require('express')();
app.get('/nocache', function(req, res) {
res.setHeader('Cache-Control', 'no-cache');
res.send(new Date().toString() + '<br><a href="https://mixmax.com">Click to navigate away and then press ' +
'Back. It will show the same timestamp.</a>');
});
app.get('/nostore', function(req, res) {
res.setHeader('Cache-Control', 'no-cache, no-store'); // Added no-store
res.send(new Date().toString() + '<br><a href="https://mixmax.com">Click to navigate away and then press ' +
'Back. It will update the timestamp.</a>');
});
app.listen('8030');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment