'Not sure how to use express-zip to download multiple files as a zip file

I tried to have a button in the front end and when the button is clicked, multiple files are downloaded. I found the express-js package, but it seemed not working for me because no files were downloaded when I used the /download in the front end. Could someone see what did I miss? Thank you!

var app = require('express')();
var zip = require('express-zip');
app.post("/download", function (req, res) {
  res.zip(
    [
      {
        path: "/path1",
        name: "filename1",
      },
      {
        path: "/path2",
        name: "filename2",
      },
    ],
    "test.zip"
  );
  console.log("finish!");
});


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source