How to send file from React/Next.js client UI to Node server and next to Flask service

Solution
// index.js
const uploadStream = (file) => {
  pass = PassThrough()
  const form = new FormData();
  form.append('flask_file_field', pass, file.originalFilename);
  form.submit('http://localhost:5000/upload', (err, res) => {
    console.error(err);
    res.resume();
  });
  return pass
};

app.post('/upload', async (req, res) => {
    const form =  formidable({
      fileWriteStreamHandler: uploadStream
    });
    form.parse(req, (err, fields, files) => {
      res.json('Success!');
    });
});
# server.py
@app.route('/upload', methods=['POST'])
def upload_file():
    if 'flask_file_field' not in request.files:
        flash('No file part')
        return redirect(request.url)
    file = request.files['flask_file_field']
    if file.filename == '':
        flash('No selected file')
        return redirect(request.url)
    if file and allowed_file(file.filename):
        filename = secure_filename(file.filename)
        file.save(os.path.join(UPLOAD_FOLDER, filename))
        return f'Uploaded {file.filename}'
    return 'File is not allowed!'