Created
August 23, 2020 08:47
-
-
Save vnnvanhuong/72bfb7822d1ff31724b10f385caa164d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const express = require('express'); | |
const PORT = process.env.PORT || 8080; | |
const app = express(); | |
app.use(express.static('public', { | |
etag: true, | |
lastModified: true, | |
setHeaders: (res, path) => { | |
if (path.endsWith('.html')) { | |
res.setHeader('Cache-control', 'no-cache'); | |
} | |
}, | |
})); | |
app.listen(PORT, function() { | |
console.log('Your server is running on port ' + PORT); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment