About how node.js returns the requested data

  node.js, question

I built a server with nodejs, and then launched an ajax request at the front desk. the server received the request and then launched a post request to other servers. now the requested data is available. I want to return to the front desk after the data is available. how should I write it?
I just got in touch with node. I don’t quite understand. Thank you all.
I’ll write this below to return no data.

var registerData='';
 req.on('data', function (chunk) {
 var data = '';
 Parse (dataplus = chunk);  //Convert to object format and send registration request
 Varmyim = newservapi ('e782429e48cb99f44b9c5effe414ac72',' b88b9f2a2f74')//instantiate a request API and then call the registration interface to initiate the request
 myIm.createUserId(imdata, function (data) {
 registerData = data;
 })
 });
 req.on('end', function () {
 res.end(registerData);
 })
console.log(content)