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

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.
主站蜘蛛池模板: 固阳县| 防城港市| 连云港市| 乳源| 高密市| 都兰县| 内江市| 延吉市| 林芝县| 孟连| 泰州市| 德清县| 五原县| 阿城市| 金昌市| 芒康县| 博乐市| 珠海市| 鹤峰县| 兰西县| 繁昌县| 会东县| 木兰县| 肥城市| 郧西县| 刚察县| 翼城县| 岳阳县| 玉溪市| 杭锦后旗| 延庆县| 靖安县| 黑水县| 临夏县| 奉节县| 平塘县| 新宾| 新乐市| 南召县| 吴堡县| 扶绥县|