How do I use Meteor.http.call?
Meteor.http is only available on sever side
The HTTP module can only be used on the server side.
1,add http
Meteor Add HTTP
2, asynchronous invocation with Wrapasync encapsulation
Meteor.methods ({ hello:function () { console.log ("server"); var posttest = function (CB) { Meteor.http.post ("Http://app.lawxin.com/version", {data: {},headers: { //) Content-type ":" Application/json ", " Accept ":" Application/json " }}, function (error, result) { Console.log ("Content", json.stringify (Result)); CB && CB (Error, result); }); Return Meteor.wrapasync (Posttest) (); } ...
CB is callback, it must be called. The format of the CB must be the function (Error,result) {} format.
3, BUG: Error whitelist rejection
Mobile-config.js:
App.accessrule (' * ');
4,add Cordova Pingxx Plugin
Meteor Add Cordova:[email protected]://github.com/tongchia/cordova-plugin-pingpp/tarball/ b7bdf93a7fbda003a8fab44967bfa5fc36488731
This plugin requires parameters when it is added, so add:
Mobile-config.js:
App.configureplugin (' co.airsia.cordova.pingpp ', {
Url_scheme: ' Meteorionic '
});
5, using Ejson
Meteor Add Ejson
Main methods:
Ejson.parse
Ejson.stringify
6, BUG: Error Charge Object
function (Error,result)
The result returned in the method is in string format.
Using payments in meteor, and interacting with the server for data