Express: Serve pre-compressed static assets

I would like to pre-compress my static assets (excluding images) and serve them.

To serve the folder public, I have:

app.use(express.static('path/to/public/'));

I believe that it express.compress()is compressed on the fly, which seems like an unnecessary load on the server processor for static assets.

What is the canonical way to achieve this?

+4
source share
1 answer

This module is connect-gzip-static . I have not tested it yet.

, , , , , .

+3

Source: https://habr.com/ru/post/1569823/


All Articles