The client uses FormData to upload files asynchronously. What should the nodejs middle tier do?

  node.js, question

Well, in the front part of react, because my form contains pictures, it uses FormData to realize asynchronous upload, and uses formidable in the middle layer of nodejs to parse and receive these data (is this okay? I did upload it successfully … although it feels a bit strange)

router.post('/publish', function(req, res, next){
 var fields=[];
 var files=[];
 var form = new formidable.IncomingForm();
 form.encoding = 'utf-8';
 form.maxFieldsSize = 2 * 1024 * 1024;
 form.keepExtensions= true;  //Preserve Suffix Format
 form.uploadDir = 'public/uploads/';
 form
 .on('field', function(field,value){
 console.log(field,value);
 fields.push({field,value});
 })
 .on('file', function(field,file){
 console.log(field,file);
 files.push({field,file});
 })
 .on('end', function(){
 console.log('-> upload done');
 console.log(fields);
 console.log(files);
 Map (function) (file) {/* rename file */
 Fs.rename (file.file.path, form.uploaddir plus file.file.name,function(err){
 if(err){
 throw err;
 };
 });
 });
 superagent.post("127.0.0.1:8000/publish")
 /* Request header is not set for the time being, because it is not known whether to' multipart/form-data' or' json'*/
 .send({
 fields : fields,
 files : files
 })
 .end(function(err,res){
 if(err || !  res.ok){
 console.log(err);
 return false;
 bracket
 Log ("data forwarded");
 });
 });
 form.parse(req);
 Res.json({ data: "oh, this is data from the server"});
 });

This is my question:
1 The framework of our project also has a python data layer. I need to pass these form data to it, so I am a little confused now. Do I need to parse the data in the nodejs middle layer? As I write now? Or is it enough to directly forward req.body to Python layer through superagent? Let the backstage handle it by itself.
My client uses superagent, not jquery ajax, so there shouldn’t be any hidden trouble, right?
Is it not necessary to upload forms asynchronously? In fact, I only want to prompt “being published” in the process of uploading, prompt “publishing successfully” after uploading, and then do page jump in the client. If it is not necessary, how else can I meet my needs?图片描述

Asynchronous uploading of forms is a very common requirement. As for the last python data layer, I think your side is interactive through http, so you can do nothing at node (this depends on your preference, because you don’t know the meaning of your middle layer. Personally, you can handle verification and authorization at the middle layer, and python only saves data).

BTW:node can use rpc with higher performance when dealing with python. Asynchronous uploading of forms is a very common requirement. As for the last python data layer,