compression
Summary
Creates a middleware handler that automatically compresses responses based on the
client's Accept-Encoding header, along with an additional Content-Type filter
by default to only apply compression to appropriate media types. Eligible responses
vary on Accept-Encoding, including when identity is selected.
Signature
function compression(options: CompressionOptions): Middleware
Example
let router = createRouter({
middleware: [compression()],
})
Parameters
options
Optional compression settings
Returns
A middleware handler that automatically compresses responses based on the client's Accept-Encoding header