Better would be to use some third party for compressing and caching. For example nginx can be used for serving and compressing static files. However if you want to keep using NodeJS, here you can view the answer: Express gzip static content. To simplify answer in short
Express 3.0 now has compress() support:
var app = express(); // gzip app.use(express.compress()); // static app.use("/public", express.static(__dirname + '/public')); // listen app.listen(80);
EDIT for Express 4.0, compress become the separate middleware. So you have to install and import to use it:
var compress = require('compression'); app.use(compress());
As for caching you can view this blog: Does express.static() cache files in the memory?. In short, nodeJS does not do caching for you, but client browser side does based on tags and headers you provide. If you want extra caching layer, you can look into CDN's like cloudflare which will not only cache your static files but also serve it from closest server to client