V
V
Vyacheslav Lebedev2015-04-20 21:45:27
Node.js
Vyacheslav Lebedev, 2015-04-20 21:45:27

How to use Cache-Control (gzippo) in node?

Good evening!
I use in a project on node, express. I set up compression (gzippo, if there is a newer / better one, write in the comments, I will be grateful), then I prescribed Cache-Control, but I am tormented by vague doubts that I have not fully configured caching.
b8dcc4225023440b8ff43c4ab3db4de2.png5fadeb734006419f9a42f50c886189ca.png
node:

app.use(gzippo.staticGzip(__dirname + '/public', {
  maxAge: 3600,
  clientMaxAge: 3600
}));

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Shatokhin, 2015-04-20
@slavikse

gzippo is a bad option because the project is abandoned and declared deprecated.
For express.js, it is better to use https://github.com/expressjs/compression (it is advisable to connect one of the first middleware, because html content must also be compressed).
There is a module for serving statics https://github.com/expressjs/serve-static

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question