Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I enable brotli compression for my NodeJS app built with express?

I would like to use Brotli compression for my node application built on express. I deliver content (HTML, CSS and JS) with app.use(express.static('public')).

I have found the shrink-ray module which does Brotli compression perfectly. However, when I install it and run the nsp check from the node security platform module, I get security vulnerabilities, which makes it impossible to use in my project.

Does anyone know a good alternative to enable Brotli compression on a node app using express? I´ve tried express-static-gzip but didn´t manage to make it work, it was still gzipped even on a simple tutorial.

like image 472
Stefan Avatar asked Mar 06 '23 17:03

Stefan


1 Answers

The new shrink-ray-current module is an alternative that works with updated dependencies.

like image 117
Stefan Avatar answered Mar 09 '23 00:03

Stefan