Skip to content

Instantly share code, notes, and snippets.

@ashinzekene
Created May 2, 2020 08:55
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 ashinzekene/d63ee7087c0695c7e5cfe93c9a0892df to your computer and use it in GitHub Desktop.
Save ashinzekene/d63ee7087c0695c7e5cfe93c9a0892df to your computer and use it in GitHub Desktop.
// A simple nodeJS express middleware for serving gzip alternatives
// Source: https://medium.com/@rajaraodv/two-quick-ways-to-reduce-react-apps-size-in-production-82226605771a
app.get('*.js', function (req, res, next) {
req.url = req.url + '.gz';
res.set('Content-Encoding', 'gzip');
next();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment