Answer the question
In order to leave comments, you need to log in
Does NODE.JS need to POST a request, wait for a response, and everything needs to be done with Fibers in a loop?
Good time everyone!
In node.js, as in js, a beginner.
You need to make a request to the https service in the post cycle, wait for a response and put this response in the subd.
There is the following code
var f = Fiber(function(t) {
var fiber = Fiber.current;
var resp = httpsclient.post({
headers: {'content-type' : 'text/html'},
url: 'myurl',
body: t.body
}, function handle_callback(error, response, body) {
//console.log('<BODY>' + body);
if (!error) {console.log( 'row_id calculated'); }
else
{console.log('<ERROR>' + e);}
});
Fiber.yield(resp);
});
var lbody = f.run(my.t);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question