mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
21 lines
518 B
TypeScript
21 lines
518 B
TypeScript
import express = require('express');
|
|
import compress = require('compression');
|
|
|
|
var app = express();
|
|
app.use(compress());
|
|
app.use(compress({
|
|
threshold: 512
|
|
}));
|
|
app.use(compress({
|
|
threshold: 512,
|
|
filter: (req: express.Request, res: express.Response) => {
|
|
if (req.headers['x-no-compression']) {
|
|
// don't compress responses with this request header
|
|
return false;
|
|
}
|
|
|
|
// fallback to standard filter function
|
|
return compress.filter(req, res);
|
|
},
|
|
}));
|