Add response compression middleware to enhance performance

This commit is contained in:
2025-04-29 10:33:13 -05:00
parent 83b38498c8
commit 1362c2755d
4 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,18 @@
package middleware
import (
"net/http"
"github.com/CAFxX/httpcompression"
)
// Compress creates a middleware that compresses HTTP responses using default settings
func Compress() Middleware {
return func(next http.Handler) http.Handler {
compress, err := httpcompression.DefaultAdapter()
if err != nil {
panic(err)
}
return compress(next)
}
}