mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-31 18:08:11 +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; | ||
|  | }; |