const express = require("express");
const compression = require("compression");
const app = express();
app.set("etag", false);
app.use(compression());
app.get("/data", (req, res) => {
return res.json({
message: "Hello, Axel Blaze, This is a test message. ".repeat(10000),
});
});
app.listen(3000, function () {
console.log("listening on 3000");
});
How to start your server & check if gzip compression is working or not!
DEBUG=compression node app.js
Tip
Make sure you pass correct Request header i.e. Accept-Encoding: gzip
Top comments (0)