Skip to content

Instantly share code, notes, and snippets.

@gaboelnuevo
Created October 30, 2019 18:18
Show Gist options
  • Save gaboelnuevo/4fe95aa03462a76b7209f65e8622bc92 to your computer and use it in GitHub Desktop.
Save gaboelnuevo/4fe95aa03462a76b7209f65e8622bc92 to your computer and use it in GitHub Desktop.
Static
const express = require('express');
const app = express();
app.use(
express.static("dist"), {
maxAge: 0,
etag: false,
setHeaders: function(res: any, path: any, stat: any) {
res.set("Cache-Control", "private, no-cache, no-store, must-revalidate");
res.set("Expires", "-1");
res.set("Pragma", "no-cache");
}
})
);
const port = process.env.PORT || 8080;
app.listen(port, () =>
console.log(`App is listening on port ${port}.`)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment