Compression

val Compression: RouteScopedPlugin<CompressionConfig>

A plugin that provides the capability to compress a response body. You can use different compression algorithms, including gzip and deflate, specify the required conditions for compressing data (such as a content type or response size), or even compress data based on specific request parameters.

The example below shows how to compress JavaScript content using gzip with the specified priority:

install(Compression) {
gzip {
priority = 0.9
matchContentType(ContentType.Application.JavaScript)
}
}

You can learn more from Compression.