How to use compression

Comprehensive compression code examples:

How to use compression.default:

50
51
52
53
54
55
56
57
58
59
app.use(bodyParser.urlencoded({ extended: false }));
function shouldCompress(req, res) {
    if (req.headers['x-no-compression']) {
        return false;
    }
    return compression_1.default.filter(req, res);
}
app.use((0, compression_1.default)({ filter: shouldCompress }));
app.use((0, express_session_1.default)({
    // @ts-ignore

How to use compression.filter:

189
190
191
192
193
194
195
196
197
198

app.use(compression({
  filter: function shouldCompress (req, res) {
    //TODO: return false here if we find a condition where we don't want to compress
    // fallback to standard filter function
    return compression.filter(req, res);
  }
}));

var appPages = {