[Vuejs]-How do I send an array of json files from the server?

0👍

Your are trying to get a file from the server, but you are using the POST method !!!

If this is what your are trying to do, so you should do something like this:

router.get('/filesFolder?:fileName', function(req, res){
    let filePath = '.. the path of your local files folder ..+ '/' +req.query.fileName
    if (fs.existsSync(filePath)) {
      //file exists
      res.sendFile(filePath);
    }
  });

Where filesFolder is the folder’s name in which you store your files; fileName is the name of the file you are requesting; filePath is the path under filesFolder of the requested file.

Leave a comment