function compressMiddleware
compressMiddleware(
ctx: Context,
next: Next
): Promise<void>

Sends the response's JSON or text compressed, in brotli or gzip as the request accepts, when it is at least MIN_BYTES long. A response already encoded, a HEAD, and one marked no-transform go out as they are.

Parameters

ctx: Context
next: Next

Return Type

Promise<void>

Usage

import { compressMiddleware } from "api/middleware/compress.ts";