const compression = require ( 'compression' ) ; import * as express from 'express' ; param app export const addCompression = ( app ) => { app . use ( compression ( { filter : shouldCompress } ) ) ; } ; const shouldCompress = ( req , res ) => { if ( req . headers [ 'x-no-compression' ] ) { return false ; } return compression . filter ( req , res ) ; } ;