boilerplate-nutella icon indicating copy to clipboard operation
boilerplate-nutella copied to clipboard

Implement gzip compression

Open allanesquina opened this issue 6 years ago • 0 comments

A good option is https://github.com/expressjs/compression

// Apply body Parser and server public assets and routes
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use((_, res, next) => {
  res.header('Access-Control-Allow-Origin', '*');
  res.header('Access-Control-Allow-Methods', 'GET,POST,PUT,OPTIONS,PATCH,DELETE');
  res.header('Access-Control-Allow-Headers', 'Content-Type,Authorization');
  res.header('Cache-Control', 'no-cache, private');
  next();
});


app.use(compression()); // <--------------------------------------------------------------


app.use(Express.static(process.env.RAZZLE_PUBLIC_DIR));
app.use(appRouting);

allanesquina avatar Jan 15 '19 08:01 allanesquina