Best Way To Do An Asynchronous Curl In Nodejs
I'm looking a way to get an asynchronous request from nodejs (exactly, server side to server side). What is the best way to do it (or at least, one way)? curl -H 'accept:text/ev
Solution 1:
The problem is that your events are named, so they are not captured by the default event message handler (the same happens in the browser implementations, except there you use the browser's addEventListener()
API to listen for events). Try this instead:
var es = new EventSource('http://api.example.com/createAccount');
es.on('status', function(e) {
// status event
console.log(e.data);
}).on('result', function(e) {
// result event
console.log(e.data);
}).on('error', function() {
console.log('ERROR!');
});
Post a Comment for "Best Way To Do An Asynchronous Curl In Nodejs"