Skip to content

Instantly share code, notes, and snippets.

@jkyberneees
Last active April 29, 2020 08:03
Show Gist options
  • Save jkyberneees/cf5537512fe02a0d09463ac2a363fe05 to your computer and use it in GitHub Desktop.
Save jkyberneees/cf5537512fe02a0d09463ac2a363fe05 to your computer and use it in GitHub Desktop.
const files = require('serve-static')
const path = require('path')
const cache = require('http-cache-middleware')
const serve = files(path.join(__dirname, 'src'), {
lastModified: false,
setHeaders: (res, path) => {
res.setHeader('cache-control', 'public, no-cache, max-age=604800')
}
})
const app = require('restana')()
app.use(cache())
app.use(serve)
app.start(3000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment