I have an application written in VueJS where I send a file, that the user uploads, to the backend. To do this I'm using Axios and I'm sending the file as a FormData. The problem is that I don't know how to access the fields in FormData when I'm in the backend.
I've sent a file using axios like this:
onUpload(): void {
    if(this.fileChosen){
      const fd = new FormData();
      fd.append('file', this.selectedFile, this.selectedFile.name);
      axios.post('http://localhost:8080/routes', fd, {
        onUploadProgress: uploadEvent => {
          console.log('Upload Progress' + Math.round(uploadEvent.loaded / uploadEvent.total) * 100 + " %");
        }
      })
      .then(
        res => {
          console.log(res);
        });
    } else {
      this.fileMsg = "You haven't chosen a file";
    }
  }
}
Then in my backend I want to access this file that I sent:
app.post('/routes', function(req, res){
    res.set("Access-Control-Allow-Origin", "*");
    // Here I want to access my file! But how?
});
 
    