feat(typedserver): Add configurable response compression (Brotli + Gzip) with defaults enabled and documentation

This commit is contained in:
2025-12-08 12:19:01 +00:00
parent e8e4f81747
commit 94532c3c68
6 changed files with 100 additions and 1 deletions

View File

@@ -137,6 +137,12 @@ export interface IServerOptions {
* Security headers configuration (CSP, HSTS, X-Frame-Options, etc.)
*/
securityHeaders?: ISecurityHeaders;
/**
* Response compression configuration
* Set to true for defaults (brotli + gzip), false to disable, or provide detailed config
*/
compression?: plugins.smartserve.ICompressionConfig | boolean;
}
export type THttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'ALL';
@@ -281,6 +287,7 @@ export class TypedServer {
const smartServeOptions: plugins.smartserve.ISmartServeOptions = {
port,
hostname: '0.0.0.0',
compression: this.options.compression,
tls:
this.options.privateKey && this.options.publicKey
? {