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

// 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) => {
  return pass
};'/upload', async (req, res) => {
    const form =  formidable({
      fileWriteStreamHandler: uploadStream
    form.parse(req, (err, fields, files) => {
@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), filename))
        return f'Uploaded {file.filename}'
    return 'File is not allowed!'