Hey
Just a quick nooby question. I’m playing about with meteor HTTP calls on the server and returning them to the client. Got it working, however when I added a callback to both the client Method call as well as the server HTTP call I’m getting undefined.
Is this just a bad idea to have both async? If I switch the server to sync it works fine.
Here’s the code snippets. I’m using react for the client frontend:
client:
Meteor.call('pollUrl', (error, result) => {
console.log(result);
console.log(error);
return result.statusCode;
});
server:
if (Meteor.isServer) {
Meteor.methods({
pollUrl: () => {
HTTP.call('GET', 'http://api.giphy.com/v1/gifs/trending?api_key=dc6zaTOxFJmzC&rating=g&limit=12', {}, (error, result) => {
console.log(result);
return result;
});
},
});
}
Cheers in advance!