Skip to content

Instantly share code, notes, and snippets.

@realtebo
Created November 16, 2018 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save realtebo/43edd8a1b23b325e2d87290d080a0003 to your computer and use it in GitHub Desktop.
Save realtebo/43edd8a1b23b325e2d87290d080a0003 to your computer and use it in GitHub Desktop.
Portion of service-worker.js
server.get("/service-worker.js", (req, res) => {
// Don't cache service worker is a best practice (otherwise clients wont get emergency bug fix)
res.set("Cache-Control", "no-store, no-cache, must-revalidate, proxy-revalidate");
res.set("Content-Type", "application/javascript");
const filePath = join(__dirname, '.next', req.url);
app.serveStatic(req, res, filePath);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment