官术网_书友最值得收藏!

Compression with Express.js

Enabling compression for Express.js saves you and your user bandwidth, and this is pretty easy to do. The following code must also be added to the server index.js file:

app.use(compress());

This middleware compresses all responses going through it. Remember to add it very high in your routing order so that all requests are affected.

Whenever you have middleware like this, or multiple routes matching the same path, you need to check the initialization order. The first matching route is executed unless you run the next command. All routes that are defined afterward will not be executed.
主站蜘蛛池模板: 新密市| 舒兰市| 佛学| 绥中县| 平顶山市| 田阳县| 和田市| 华安县| 博兴县| 河北区| 随州市| 玛纳斯县| 邵阳市| 平舆县| 广水市| 岳阳市| 莱芜市| 阿尔山市| 临夏县| 苗栗市| 福贡县| 凌海市| 新源县| 三台县| 伊春市| 石狮市| 新平| 墨竹工卡县| 南江县| 泸水县| 莲花县| 观塘区| 永安市| 南安市| 巴里| 德保县| 福海县| 镶黄旗| 庄河市| 大姚县| 辛集市|