mirror of
https://github.com/strapi/strapi.git
synced 2025-07-15 04:53:17 +00:00
33 lines
392 B
JavaScript
33 lines
392 B
JavaScript
![]() |
'use strict';
|
||
|
|
||
|
/**
|
||
|
* Gzip hook
|
||
|
*/
|
||
|
|
||
|
module.exports = function (strapi) {
|
||
|
const hook = {
|
||
|
|
||
|
/**
|
||
|
* Default options
|
||
|
*/
|
||
|
|
||
|
defaults: {
|
||
|
gzip: true
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* Initialize the hook
|
||
|
*/
|
||
|
|
||
|
initialize: function (cb) {
|
||
|
if (strapi.config.gzip === true) {
|
||
|
strapi.app.use(strapi.middlewares.gzip());
|
||
|
}
|
||
|
|
||
|
cb();
|
||
|
}
|
||
|
};
|
||
|
|
||
|
return hook;
|
||
|
};
|